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

Skip to content

Commit a8018e8

Browse files
authored
Merge pull request #14302 from meeseeksmachine/auto-backport-of-pr-14255-on-v3.1.x
Backport PR #14255 on branch v3.1.x (Improve docsstring of Axes.streamplot)
2 parents 5c5e638 + 3bc1f5e commit a8018e8

File tree

1 file changed

+28
-24
lines changed

1 file changed

+28
-24
lines changed

lib/matplotlib/streamplot.py

Lines changed: 28 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -25,42 +25,47 @@ def streamplot(axes, x, y, u, v, density=1, linewidth=None, color=None,
2525
2626
Parameters
2727
----------
28-
x, y : 1d arrays
28+
x, y : 1D arrays
2929
An evenly spaced grid.
30-
u, v : 2d arrays
31-
*x* and *y*-velocities. Number of rows should match length of *y*, and
32-
the number of columns should match *x*.
33-
density : float or 2-tuple
30+
u, v : 2D arrays
31+
*x* and *y*-velocities. The number of rows and columns must match
32+
the length of *y* and *x*, respectively.
33+
density : float or (float, float)
3434
Controls the closeness of streamlines. When ``density = 1``, the domain
35-
is divided into a 30x30 grid---*density* linearly scales this grid.
35+
is divided into a 30x30 grid. *density* linearly scales this grid.
3636
Each cell in the grid can have, at most, one traversing streamline.
37-
For different densities in each direction, use [density_x, density_y].
38-
linewidth : numeric or 2d array
39-
Vary linewidth when given a 2d array with the same shape as velocities.
40-
color : matplotlib color code, or 2d array
41-
Streamline color. When given an array with the same shape as
42-
velocities, *color* values are converted to colors using *cmap*.
37+
For different densities in each direction, use a tuple
38+
(density_x, density_y).
39+
linewidth : float or 2D array
40+
The width of the stream lines. With a 2D array the line width can be
41+
varied across the grid. The array must have the same shape as *u*
42+
and *v*.
43+
color : matplotlib color code, or 2D array
44+
The streamline color. If given an array, its values are converted to
45+
colors using *cmap* and *norm*. The array must have the same shape
46+
as *u* and *v*.
4347
cmap : `~matplotlib.colors.Colormap`
44-
Colormap used to plot streamlines and arrows. Only necessary when using
45-
an array input for *color*.
48+
Colormap used to plot streamlines and arrows. This is only used if
49+
*color* is an array.
4650
norm : `~matplotlib.colors.Normalize`
4751
Normalize object used to scale luminance data to 0, 1. If ``None``,
48-
stretch (min, max) to (0, 1). Only necessary when *color* is an array.
52+
stretch (min, max) to (0, 1). This is only used if *color* is an array.
4953
arrowsize : float
50-
Factor scale arrow size.
54+
Scaling factor for the arrow size.
5155
arrowstyle : str
5256
Arrow style specification.
5357
See `~matplotlib.patches.FancyArrowPatch`.
5458
minlength : float
5559
Minimum length of streamline in axes coordinates.
5660
start_points : Nx2 array
57-
Coordinates of starting points for the streamlines.
58-
In data coordinates, the same as the *x* and *y* arrays.
61+
Coordinates of starting points for the streamlines in data coordinates
62+
(the same coordinates as the *x* and *y* arrays).
5963
zorder : int
60-
Any number.
64+
The zorder of the stream lines and arrows.
65+
Artists with lower zorder values are drawn first.
6166
maxlength : float
6267
Maximum length of streamline in axes coordinates.
63-
integration_direction : ['forward' | 'backward' | 'both']
68+
integration_direction : {'forward', 'backward', 'both'}
6469
Integrate the streamline in forward, backward or both directions.
6570
default is ``'both'``.
6671
@@ -69,11 +74,10 @@ def streamplot(axes, x, y, u, v, density=1, linewidth=None, color=None,
6974
stream_container : StreamplotSet
7075
Container object with attributes
7176
72-
- lines: `matplotlib.collections.LineCollection` of streamlines
77+
- ``lines``: `.LineCollection` of streamlines
7378
74-
- arrows: collection of `matplotlib.patches.FancyArrowPatch`
75-
objects representing arrows half-way along stream
76-
lines.
79+
- ``arrows``: `.PatchCollection` containing `.FancyArrowPatch`
80+
objects representing the arrows half-way along stream lines.
7781
7882
This container will probably change in the future to allow changes
7983
to the colormap, alpha, etc. for both lines and arrows, but these

0 commit comments

Comments
 (0)