You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Non-working 'set_visible' method for PatchCollection #6000
import numpy as np
import matplotlib.pyplot as plt
# Data
x = np.linspace(-10, 10, 10)
y = np.linspace(-10, 10, 10)
X, Y = np.meshgrid(x, y)
U = X
V = X**2
# basic streamline plot
plt.figure()
sp1 = plt.streamplot(x, y, U, V)
# Attempt to hide lines and arrows from streamline plot
plt.figure()
sp2 = plt.streamplot(x, y, U, V)
sp2.lines.set_visible(False)
sp2.arrows.set_visible(False)
plt.show()
I expected the last plot to be empty, don't know if it is the wanted behaviour though.
Interesting, looking at the code for streamplot, the arrows are each added as individual patches, then put into the collection and the collection is returned.
And the obvious thing of not adding the arrows as they are created and adding the PatchCollection later results in the arrows not being drawn at all (not sure why yet).
I tried adding a simple arrow through PatchCollection without success.
If I'm using PatchCollection right it could explain why Axes.add_patches is necessary for streamplot() to show arrows...
I'm also confused about the use of transform in that particular case. In streamplot(), transform argument is specified at FancyArrowPatch creation and at PatchCollection creation.
Is it the right way of doing it ? because even a classic patch (the ellipse in the linked script) is not displayed right in that case.
Activity
tacaswell commentedon Feb 14, 2016
Can you provide a minimal (not) working example?
galaunay commentedon Feb 14, 2016
Sure,
I expected the last plot to be empty, don't know if it is the wanted behaviour though.
tacaswell commentedon Feb 15, 2016
Interesting, looking at the code for streamplot, the arrows are each added as individual patches, then put into the collection and the collection is returned.
tacaswell commentedon Feb 15, 2016
And the obvious thing of not adding the arrows as they are created and adding the PatchCollection later results in the arrows not being drawn at all (not sure why yet).
galaunay commentedon Feb 29, 2016
I tried adding a simple arrow through
PatchCollectionwithout success.If I'm using
PatchCollectionright it could explain whyAxes.add_patchesis necessary forstreamplot()to show arrows...I'm also confused about the use of
transformin that particular case. Instreamplot(),transformargument is specified atFancyArrowPatchcreation and atPatchCollectioncreation.Is it the right way of doing it ? because even a classic patch (the ellipse in the linked script) is not displayed right in that case.
QuLogic commentedon Aug 7, 2020
This is in essence a duplicate of #2341, namely that
streamplotreturns a uselessPatchCollectionbecause it can't drawFancyArrowPatchs.