-
-
Notifications
You must be signed in to change notification settings - Fork 7.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PatchCollection doesn't properly handle FancyArrowPatch, breaking StreamplotSet.arrows #2341
Comments
I'm guessing incompatibilities between |
Confirming this is still an issue in 1.5.3 import numpy as np
import matplotlib.pyplot as plt
w = 3
Y, X = np.mgrid[-w:w:100j, -w:w:100j]
U = -1 - X**2 + Y
V = 1 + X - Y**2
c = plt.streamplot(X, Y, U, V, color=(0,0,0,1))
c.lines.set_alpha(0)
c.arrows.set_alpha(0)
plt.show() PR still welcome here, would recommend reading through #2500 despite it stalling. Recommend labeling with confirmed bug |
Just to comment that fixing this bug will benefit networkx arrow-drawing (see here) as arrows are |
I had a quick look at this. I think the solution likely involves using PatchCollection with TransformedPatchPath entries, so that the transform info stays in the collection. But additionally, the draw-time computation done in FancyArrowPatch will need to move from |
Will this bug be ever fixed? I need to plot hundreds of annotations and it is awfully slow... |
This issue has been marked "inactive" because it has been 365 days since the last comment. If this issue is still present in recent Matplotlib releases, or the feature request is still wanted, please leave a comment and this label will be removed. If there are no updates in another 30 days, this issue will be automatically closed, but you are free to re-open or create a new issue if needed. We value issue reports, and this procedure is meant to help us resurface and prioritize issues that have not been addressed yet, not make them disappear. Thanks for your help! |
My |
As discussed in this SO question and this mailing list thread, PatchCollection cannot handle FancyArrowPatch patches, as the paths for FancyArrowPatch can't be evaluated during PatchCollection creation. It appears that an issue was never created for this... please let me know if I'm being stupid and not noticing one.
As such, the StreamplotSet.arrows PatchCollection appears to be entirely useless. In fact, streamplot() doesn't even add the collection to the axis, instead adding the individual patches, and then creating an apparently unused PatchCollection to return. This means that things that should work, like, for a StreamplotSet
s
, doings.arrows.set_visible(False)
, will not work, nor, to my knowledge, will doing anything with StreamplotSet.arrows have the desired result.As discussed in the mailing list thread, one potential solution to this would be to create a FancyArrowPatchCollection class especially for FancyArrowPatch, and then use this for streamplot; someone in the thread also gives a rudimentary class. If I have time, I might try to implement this, but does anyone have any better ideas?
The text was updated successfully, but these errors were encountered: