Skip to content
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

Closed
cgevans opened this issue Aug 24, 2013 · 8 comments
Labels
New feature status: closed as inactive Issues closed by the "Stale" Github Action. Please comment on any you think should still be open. status: confirmed bug status: inactive Marked by the “Stale” Github Action topic: arrow

Comments

@cgevans
Copy link
Contributor

cgevans commented Aug 24, 2013

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, doing s.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?

@tonysyu
Copy link
Contributor

tonysyu commented Oct 6, 2013

I'm guessing incompatibilities between FancyArrowPatch and PatchCollection was the reason the arrow collection is not added to axes. (To be honest, I don't remember.) I'm not sure what a full implementation of a FancyArrowPatchCollection would require, so I tried implementing a simpler fix using FancyArrow instead (See PR #2500).

@tacaswell tacaswell added this to the v1.5.x milestone Aug 17, 2014
@tacaswell
Copy link
Member

@cgevans Did you make any progress on this?

@tonysyu Any interest in reviving #2500?

@petehuang
Copy link
Contributor

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

@dstansby dstansby added this to Current bugs in Arrow drawing overhaul Mar 8, 2017
@tacaswell tacaswell modified the milestones: 2.1 (next point release), 2.2 (next next feature release) Oct 3, 2017
@rodogi
Copy link

rodogi commented Dec 13, 2017

Just to comment that fixing this bug will benefit networkx arrow-drawing (see here) as arrows are FancyArrowPatch instances.

@anntzer
Copy link
Contributor

anntzer commented Jan 20, 2021

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 get_path_in_displaycoord to a custom transform subclass, which contains the relevant logic but will be able to be combined with other transforms); this is likely the trickier part.

@yves-surrel
Copy link

Will this bug be ever fixed? I need to plot hundreds of annotations and it is awfully slow...

@QuLogic QuLogic mentioned this issue Mar 1, 2022
6 tasks
@github-actions
Copy link

github-actions bot commented Mar 3, 2023

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!

@github-actions github-actions bot added the status: inactive Marked by the “Stale” Github Action label Mar 3, 2023
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Apr 3, 2023
@rcomer rcomer added the status: closed as inactive Issues closed by the "Stale" Github Action. Please comment on any you think should still be open. label May 30, 2023
@robinfissum
Copy link

My some_streamplotset.arrows.remove() continues to fail... Any updates on this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
New feature status: closed as inactive Issues closed by the "Stale" Github Action. Please comment on any you think should still be open. status: confirmed bug status: inactive Marked by the “Stale” Github Action topic: arrow
Projects
No open projects
Development

No branches or pull requests