Skip to content

Commit ed97211

Browse files
dstansbytimhoffm
authored andcommitted
Convert streamplot to numpydoc (#13078)
* Convert streamplot to numpydoc * Small streamplot doc fixes
1 parent 354a430 commit ed97211

File tree

1 file changed

+41
-38
lines changed

1 file changed

+41
-38
lines changed

lib/matplotlib/streamplot.py

Lines changed: 41 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -20,61 +20,64 @@ def streamplot(axes, x, y, u, v, density=1, linewidth=None, color=None,
2020
cmap=None, norm=None, arrowsize=1, arrowstyle='-|>',
2121
minlength=0.1, transform=None, zorder=None, start_points=None,
2222
maxlength=4.0, integration_direction='both'):
23-
"""Draw streamlines of a vector flow.
24-
25-
*x*, *y* : 1d arrays
26-
an *evenly spaced* grid.
27-
*u*, *v* : 2d arrays
28-
x and y-velocities. Number of rows should match length of y, and
29-
the number of columns should match x.
30-
*density* : float or 2-tuple
31-
Controls the closeness of streamlines. When `density = 1`, the domain
23+
"""
24+
Draw streamlines of a vector flow.
25+
26+
Parameters
27+
----------
28+
x, y : 1d arrays
29+
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
34+
Controls the closeness of streamlines. When ``density = 1``, the domain
3235
is divided into a 30x30 grid---*density* linearly scales this grid.
3336
Each cell in the grid can have, at most, one traversing streamline.
3437
For different densities in each direction, use [density_x, density_y].
35-
*linewidth* : numeric or 2d array
36-
vary linewidth when given a 2d array with the same shape as velocities.
37-
*color* : matplotlib color code, or 2d array
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
3841
Streamline color. When given an array with the same shape as
3942
velocities, *color* values are converted to colors using *cmap*.
40-
*cmap* : :class:`~matplotlib.colors.Colormap`
43+
cmap : `~matplotlib.colors.Colormap`
4144
Colormap used to plot streamlines and arrows. Only necessary when using
4245
an array input for *color*.
43-
*norm* : :class:`~matplotlib.colors.Normalize`
44-
Normalize object used to scale luminance data to 0, 1. If None, stretch
45-
(min, max) to (0, 1). Only necessary when *color* is an array.
46-
*arrowsize* : float
46+
norm : `~matplotlib.colors.Normalize`
47+
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.
49+
arrowsize : float
4750
Factor scale arrow size.
48-
*arrowstyle* : str
51+
arrowstyle : str
4952
Arrow style specification.
50-
See :class:`~matplotlib.patches.FancyArrowPatch`.
51-
*minlength* : float
53+
See `~matplotlib.patches.FancyArrowPatch`.
54+
minlength : float
5255
Minimum length of streamline in axes coordinates.
53-
*start_points*: Nx2 array
56+
start_points : Nx2 array
5457
Coordinates of starting points for the streamlines.
55-
In data coordinates, the same as the ``x`` and ``y`` arrays.
56-
*zorder* : int
57-
any number
58-
*maxlength* : float
58+
In data coordinates, the same as the *x* and *y* arrays.
59+
zorder : int
60+
Any number.
61+
maxlength : float
5962
Maximum length of streamline in axes coordinates.
60-
*integration_direction* : ['forward', 'backward', 'both']
63+
integration_direction : ['forward' | 'backward' | 'both']
6164
Integrate the streamline in forward, backward or both directions.
65+
default is ``'both'``.
6266
63-
Returns:
64-
65-
*stream_container* : StreamplotSet
66-
Container object with attributes
67-
68-
- lines: `matplotlib.collections.LineCollection` of streamlines
67+
Returns
68+
-------
69+
stream_container : StreamplotSet
70+
Container object with attributes
6971
70-
- arrows: collection of `matplotlib.patches.FancyArrowPatch`
71-
objects representing arrows half-way along stream
72-
lines.
72+
- lines: `matplotlib.collections.LineCollection` of streamlines
7373
74-
This container will probably change in the future to allow changes
75-
to the colormap, alpha, etc. for both lines and arrows, but these
76-
changes should be backward compatible.
74+
- arrows: collection of `matplotlib.patches.FancyArrowPatch`
75+
objects representing arrows half-way along stream
76+
lines.
7777
78+
This container will probably change in the future to allow changes
79+
to the colormap, alpha, etc. for both lines and arrows, but these
80+
changes should be backward compatible.
7881
"""
7982
grid = Grid(x, y)
8083
mask = StreamMask(density)

0 commit comments

Comments
 (0)