8000 improved documentation of quvier plot · matplotlib/matplotlib@d902ee3 · GitHub
[go: up one dir, main page]

Skip to content

Commit d902ee3

Browse files
committed
improved documentation of quvier plot
1 parent ab96b8f commit d902ee3

File tree

1 file changed

+21
-9
lines changed

1 file changed

+21
-9
lines changed

lib/matplotlib/quiver.py

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -87,21 +87,29 @@
8787
angles : {'uv', 'xy'} or array-like, default: 'uv'
8888
Method for determining the angle of the arrows.
8989
90-
- 'uv': Arrow direction in screen coordinates. Use this if the arrows
91-
symbolize a quantity that is not based on *X*, *Y* data coordinates.
90+
- 'uv': Arrow directions are based on
91+
:ref:`display coordinates <coordinate-systems>`; i.e. a 45° angle will
92+
always show up as diagonal on the screen, irrespective of figure or Axes
93+
aspect ratio or Axes data ranges. This is useful when the arrows represent
94+
a quantity whose direction is not tied to the x and y data coordinates.
9295
9396
If *U* == *V* the orientation of the arrow on the plot is 45 degrees
9497
counter-clockwise from the horizontal axis (positive to the right).
9598
9699
- 'xy': Arrow direction in data coordinates, i.e. the arrows point from
97-
(x, y) to (x+u, y+v). Use this e.g. for plotting a gradient field.
100+
(x, y) to (x+u, y+v). This is ideal for vector fields or gradient plots
101+
where the arrows should directly represent movements or gradients in the
102+
x and y directions.
98103
99104
- Arbitrary angles may be specified explicitly as an array of values
100105
in degrees, counter-clockwise from the horizontal axis.
101106
102107
In this case *U*, *V* is only used to determine the length of the
103108
arrows.
104109
110+
For example, ``angles=[30, 60, 90]`` will orient the arrows at 30, 60, and 90
111+
degrees respectively, regardless of the *U* and *V* components.
112+
105113
Note: inverting a data axis will correspondingly invert the
106114
arrows only with ``angles='xy'``.
107115
@@ -114,23 +122,27 @@
114122
scale : float, optional
115123
Scales the length of the arrow inversely.
116124
117-
Number of data units per arrow length unit, e.g., m/s per plot width; a
118-
smaller scale parameter makes the arrow longer. Default is *None*.
125+
Number of data units per represented by one unit of arrow length on the plot.
126+
For example, if the data represents velocity in meters per second (m/s), the
127+
scale parameter determines how many meters per second correspond to one unit of
128+
arrow length relative to the width of the plot.
129+
Smaller scale parameter makes the arrow longer. Default is *None*.
119130
120131
If *None*, a simple autoscaling algorithm is used, based on the average
121132
vector length and the number of vectors. The arrow length unit is given by
122133
the *scale_units* parameter.
123134
124135
scale_units : {'width', 'height', 'dots', 'inches', 'x', 'y', 'xy'}, optional
125-
If the *scale* kwarg is *None*, the arrow length unit. Default is *None*.
136+
If the *scale* kwarg is *None*, the arrow length unit is automatically chosen based
137+
on scale_units. Default is *None*.
126138
127139
e.g. *scale_units* is 'inches', *scale* is 2.0, and ``(u, v) = (1, 0)``,
128140
then the vector will be 0.5 inches long.
129141
130-
If *scale_units* is 'width' or 'height', then the vector will be half the
131-
width/height of the axes.
142+
If *scale_units* is 'width' or 'height', and *scale* is 2.0, then the vector will
143+
be half the width/height of the axes.
132144
133-
If *scale_units* is 'x' then the vector will be 0.5 x-axis
145+
If *scale_units* is 'x', and *scale* is 2.0, then the vector will be 0.5 x-axis
134146
units. To plot vectors in the x-y plane, with u and v having
135147
the same units as x and y, use
136148
``angles='xy', scale_units='xy', scale=1``.

0 commit comments

Comments
 (0)
0