Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 037f25c

Browse files
committed
Merge pull request #2225 from mgoacolou/master
add zorder to streamplot
2 parents 57c14f7 + 2a53a90 commit 037f25c

File tree

3 files changed

+12
-5
lines changed

3 files changed

+12
-5
lines changed

lib/matplotlib/axes/_axes.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3811,7 +3811,7 @@ def stackplot(self, x, *args, **kwargs):
38113811

38123812
def streamplot(self, x, y, u, v, density=1, linewidth=None, color=None,
38133813
cmap=None, norm=None, arrowsize=1, arrowstyle='-|>',
3814-
minlength=0.1, transform=None):
3814+
minlength=0.1, transform=None, zorder=1):
38153815
if not self._hold:
38163816
self.cla()
38173817
stream_container = mstream.streamplot(self, x, y, u, v,
@@ -3823,7 +3823,8 @@ def streamplot(self, x, y, u, v, density=1, linewidth=None, color=None,
38233823
arrowsize=arrowsize,
38243824
arrowstyle=arrowstyle,
38253825
minlength=minlength,
3826-
transform=transform)
3826+
transform=transform,
3827+
zorder=zorder)
38273828
return stream_container
38283829
streamplot.__doc__ = mstream.streamplot.__doc__
38293830

lib/matplotlib/pyplot.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3213,7 +3213,7 @@ def step(x, y, *args, **kwargs):
32133213
@_autogen_docstring(Axes.streamplot)
32143214
def streamplot(x, y, u, v, density=1, linewidth=None, color=None, cmap=None,
32153215
norm=None, arrowsize=1, arrowstyle='-|>', minlength=0.1,
3216-
transform=None, hold=None):
3216+
transform=None, hold=None, zorder=1):
32173217
ax = gca()
32183218
# allow callers to override the hold state by passing hold=True|False
32193219
washold = ax.ishold()
@@ -3224,7 +3224,8 @@ def streamplot(x, y, u, v, density=1, linewidth=None, color=None, cmap=None,
32243224
ret = ax.streamplot(x, y, u, v, density=density, linewidth=linewidth,
32253225
color=color, cmap=cmap, norm=norm,
32263226
arrowsize=arrowsize, arrowstyle=arrowstyle,
3227-
minlength=minlength, transform=transform)
3227+
minlength=minlength, transform=transform,
3228+
zorder=zorder)
32283229
draw_if_interactive()
32293230
finally:
32303231
ax.hold(washold)

lib/matplotlib/streamplot.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
def streamplot(axes, x, y, u, v, density=1, linewidth=None, color=None,
1818
cmap=None, norm=None, arrowsize=1, arrowstyle='-|>',
19-
minlength=0.1, transform=None):
19+
minlength=0.1, transform=None, zorder=1):
2020
"""Draws streamlines of a vector flow.
2121
2222
*x*, *y* : 1d arrays
@@ -47,6 +47,8 @@ def streamplot(axes, x, y, u, v, density=1, linewidth=None, color=None,
4747
See :class:`~matplotlib.patches.FancyArrowPatch`.
4848
*minlength* : float
4949
Minimum length of streamline in axes coordinates.
50+
*zorder* : int
51+
any number
5052
5153
Returns:
5254
@@ -98,6 +100,9 @@ def streamplot(axes, x, y, u, v, density=1, linewidth=None, color=None,
98100
line_kw['linewidth'] = linewidth
99101
arrow_kw['linewidth'] = linewidth
100102

103+
line_kw['zorder'] = zorder
104+
arrow_kw['zorder'] = zorder
105+
101106
## Sanity checks.
102107
assert u.shape == grid.shape
103108
assert v.shape == grid.shape

0 commit comments

Comments
 (0)