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

Skip to content

Commit a63463f

Browse files
authored
Merge pull request #7188 from bcongdon/streamplot-zorder
MNT: Remove hard-coded streamplot zorder kwarg
2 parents 9df6829 + 55ce380 commit a63463f

File tree

3 files changed

+14
-2
lines changed

3 files changed

+14
-2
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
Streamplot Zorder Keyword Argument Changes
2+
------------------------------------------
3+
4+
The ``zorder`` parameter for :func:`streamplot` now has default
5+
value of ``None`` instead of ``2``. If ``None`` is given as ``zorder``,
6+
:func:`streamplot` has a default ``zorder`` of
7+
``matplotlib.lines.Line2D.zorder``.

lib/matplotlib/axes/_axes.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4610,7 +4610,8 @@ def stackplot(self, x, *args, **kwargs):
46104610
label_namer=None)
46114611
def streamplot(self, x, y, u, v, density=1, linewidth=None, color=None,
46124612
cmap=None, norm=None, arrowsize=1, arrowstyle='-|>',
4613-
minlength=0.1, transform=None, zorder=2, start_points=None):
4613+
minlength=0.1, transform=None, zorder=None,
4614+
start_points=None):
46144615
if not self._hold:
46154616
self.cla()
46164617
stream_container = mstream.streamplot(self, x, y, u, v,

lib/matplotlib/streamplot.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
import matplotlib.cm as cm
1414
import matplotlib.colors as mcolors
1515
import matplotlib.collections as mcollections
16+
import matplotlib.lines as mlines
1617
import matplotlib.patches as patches
1718

1819

@@ -21,7 +22,7 @@
2122

2223
def streamplot(axes, x, y, u, v, density=1, linewidth=None, color=None,
2324
cmap=None, norm=None, arrowsize=1, arrowstyle='-|>',
24-
minlength=0.1, transform=None, zorder=2, start_points=None):
25+
minlength=0.1, transform=None, zorder=None, start_points=None):
2526
"""Draws streamlines of a vector flow.
2627
2728
*x*, *y* : 1d arrays
@@ -78,6 +79,9 @@ def streamplot(axes, x, y, u, v, density=1, linewidth=None, color=None,
7879
mask = StreamMask(density)
7980
dmap = DomainMap(grid, mask)
8081

82+
if zorder is None:
83+
zorder = mlines.Line2D.zorder
84+
8185
# default to data coordinates
8286
if transform is None:
8387
transform = axes.transData

0 commit comments

Comments
 (0)