Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions doc/users/whats_new/streamplot_zorder.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Streamplot Zorder Keyword Argument Changes
------------------------------------------

The ``zorder`` parameter for :func:`streamplot` now has default
value of ``None`` instead of ``2``. If ``None`` is given as ``zorder``,
:func:`streamplot` has a default ``zorder`` of
``matplotlib.lines.Line2D.zorder``.
3 changes: 2 additions & 1 deletion lib/matplotlib/axes/_axes.py
Original file line number Diff line number Diff line change
Expand Up @@ -4613,7 +4613,8 @@ def stackplot(self, x, *args, **kwargs):
label_namer=None)
def streamplot(self, x, y, u, v, density=1, linewidth=None, color=None,
cmap=None, norm=None, arrowsize=1, arrowstyle='-|>',
minlength=0.1, transform=None, zorder=2, start_points=None):
minlength=0.1, transform=None, zorder=None,
start_points=None):
if not self._hold:
self.cla()
stream_container = mstream.streamplot(self, x, y, u, v,
Expand Down
6 changes: 5 additions & 1 deletion lib/matplotlib/streamplot.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import matplotlib.cm as cm
import matplotlib.colors as mcolors
import matplotlib.collections as mcollections
import matplotlib.lines as mlines
import matplotlib.patches as patches


Expand All @@ -21,7 +22,7 @@

def streamplot(axes, x, y, u, v, density=1, linewidth=None, color=None,
cmap=None, norm=None, arrowsize=1, arrowstyle='-|>',
minlength=0.1, transform=None, zorder=2, start_points=None):
minlength=0.1, transform=None, zorder=None, start_points=None):
"""Draws streamlines of a vector flow.

*x*, *y* : 1d arrays
Expand Down Expand Up @@ -78,6 +79,9 @@ def streamplot(axes, x, y, u, v, density=1, linewidth=None, color=None,
mask = StreamMask(density)
dmap = DomainMap(grid, mask)

if zorder is None:
zorder = mlines.Line2D.zorder

# default to data coordinates
if transform is None:
transform = axes.transData
Expand Down