|
29 | 29 |
|
30 | 30 |
|
31 | 31 | _quiver_doc = """
|
32 |
| -Plot a 2-D field of arrows. |
| 32 | +Plot a 2D field of arrows. |
33 | 33 |
|
34 |
| -Call signatures:: |
| 34 | +Call signature:: |
35 | 35 |
|
36 |
| - quiver(U, V, **kw) |
37 |
| - quiver(U, V, C, **kw) |
38 |
| - quiver(X, Y, U, V, **kw) |
39 |
| - quiver(X, Y, U, V, C, **kw) |
| 36 | + quiver([X, Y], U, V, [C], **kw) |
40 | 37 |
|
41 |
| -*U* and *V* are the arrow data, *X* and *Y* set the location of the |
42 |
| -arrows, and *C* sets the color of the arrows. These arguments may be 1-D or |
43 |
| -2-D arrays or sequences. |
| 38 | +Where *X*, *Y* define the arrow locations, *U*, *V* define the arrow |
| 39 | +directions, and *C* optionally sets the color. |
44 | 40 |
|
45 |
| -If *X* and *Y* are absent, they will be generated as a uniform grid. |
46 |
| -If *U* and *V* are 2-D arrays and *X* and *Y* are 1-D, and if ``len(X)`` and |
47 |
| -``len(Y)`` match the column and row dimensions of *U*, then *X* and *Y* will be |
48 |
| -expanded with :func:`numpy.meshgrid`. |
| 41 | +**Arrow size** |
49 | 42 |
|
50 | 43 | The default settings auto-scales the length of the arrows to a reasonable size.
|
51 |
| -To change this behavior see the *scale* and *scale_units* kwargs. |
| 44 | +To change this behavior see the *scale* and *scale_units* parameters. |
| 45 | +
|
| 46 | +**Arrow shape** |
52 | 47 |
|
53 | 48 | The defaults give a slightly swept-back arrow; to make the head a
|
54 | 49 | triangle, make *headaxislength* the same as *headlength*. To make the
|
|
57 | 52 | scale down all the head parameters. You will probably do best to leave
|
58 | 53 | minshaft alone.
|
59 | 54 |
|
| 55 | +**Arrow outline** |
| 56 | +
|
60 | 57 | *linewidths* and *edgecolors* can be used to customize the arrow
|
61 | 58 | outlines.
|
62 | 59 |
|
63 | 60 | Parameters
|
64 | 61 | ----------
|
65 |
| -X : 1D or 2D array, sequence, optional |
66 |
| - The x coordinates of the arrow locations |
67 |
| -Y : 1D or 2D array, sequence, optional |
68 |
| - The y coordinates of the arrow locations |
69 |
| -U : 1D or 2D array or masked array, sequence |
70 |
| - The x components of the arrow vectors |
71 |
| -V : 1D or 2D array or masked array, sequence |
72 |
| - The y components of the arrow vectors |
73 |
| -C : 1D or 2D array, sequence, optional |
74 |
| - The arrow colors |
75 |
| -units : [ 'width' | 'height' | 'dots' | 'inches' | 'x' | 'y' | 'xy' ] |
| 62 | +X, Y : 1D or 2D array-like, optional |
| 63 | + The x and y coordinates of the arrow locations. |
| 64 | +
|
| 65 | + If not given, they will be generated as a uniform integer meshgrid based |
| 66 | + on the dimensions of *U* and *V*. |
| 67 | +
|
| 68 | + If *X* and *Y* are 1D but *U*, *V* are 2D, *X*, *Y* are expanded to 2D |
| 69 | + using ``X, Y = np.meshgrid(X, Y)``. In this case ``len(X)`` and ``len(Y)`` |
| 70 | + must match the column and row dimensions of *U* and *V*. |
| 71 | +
|
| 72 | +U, V : 1D or 2D array-like |
| 73 | + The x and y direction components of the arrow vectors. |
| 74 | +
|
| 75 | +C : 1D or 2D array-like, optional |
| 76 | + Numeric data that defines the arrow colors by colormapping via *norm* and |
| 77 | + *cmap*. |
| 78 | +
|
| 79 | + This does not support explicit colors. If you want to set colors directly, |
| 80 | + use *color* instead. |
| 81 | +
|
| 82 | +units : {'width', 'height', 'dots', 'inches', 'x', 'y' 'xy'}, default: 'width' |
76 | 83 | The arrow dimensions (except for *length*) are measured in multiples of
|
77 | 84 | this unit.
|
78 | 85 |
|
79 |
| - 'width' or 'height': the width or height of the axis |
80 |
| -
|
81 |
| - 'dots' or 'inches': pixels or inches, based on the figure dpi |
| 86 | + The following values are supported: |
82 | 87 |
|
83 |
| - 'x', 'y', or 'xy': respectively *X*, *Y*, or :math:`\\sqrt{X^2 + Y^2}` |
84 |
| - in data units |
| 88 | + - 'width', 'height': The width or height of the axis. |
| 89 | + - 'dots', 'inches': Pixels or inches based on the figure dpi. |
| 90 | + - 'x', 'y', 'xy': *X*, *Y* or :math:`\\sqrt{X^2 + Y^2}` in data units. |
85 | 91 |
|
86 | 92 | The arrows scale differently depending on the units. For
|
87 | 93 | 'x' or 'y', the arrows get larger as one zooms in; for other
|
88 | 94 | units, the arrow size is independent of the zoom state. For
|
89 | 95 | 'width or 'height', the arrow size increases with the width and
|
90 | 96 | height of the axes, respectively, when the window is resized;
|
91 | 97 | for 'dots' or 'inches', resizing does not change the arrows.
|
92 |
| -angles : [ 'uv' | 'xy' ], array, optional |
93 |
| - Method for determining the angle of the arrows. Default is 'uv'. |
94 | 98 |
|
95 |
| - 'uv': the arrow axis aspect ratio is 1 so that |
96 |
| - if *U*==*V* the orientation of the arrow on the plot is 45 degrees |
97 |
| - counter-clockwise from the horizontal axis (positive to the right). |
| 99 | +angles : {'uv', 'xy'} or array-like, optional, default: 'uv' |
| 100 | + Method for determining the angle of the arrows. |
| 101 | +
|
| 102 | + - 'uv': The arrow axis aspect ratio is 1 so that |
| 103 | + if *U* == *V* the orientation of the arrow on the plot is 45 degrees |
| 104 | + counter-clockwise from the horizontal axis (positive to the right). |
| 105 | +
|
| 106 | + Use this if the arrows symbolize a quantity that is not based on |
| 107 | + *X*, *Y* data coordinates. |
| 108 | +
|
| 109 | + - 'xy': Arrows point from (x,y) to (x+u, y+v). |
| 110 | + Use this for plotting a gradient field, for example. |
98 | 111 |
|
99 |
| - 'xy': arrows point from (x,y) to (x+u, y+v). |
100 |
| - Use this for plotting a gradient field, for example. |
| 112 | + - Alternatively, arbitrary angles may be specified explicitly as an array |
| 113 | + of values in degrees, counter-clockwise from the horizontal axis. |
101 | 114 |
|
102 |
| - Alternatively, arbitrary angles may be specified as an array |
103 |
| - of values in degrees, counter-clockwise from the horizontal axis. |
| 115 | + In this case *U*, *V* is only used to determine the length of the |
| 116 | + arrows. |
104 | 117 |
|
105 | 118 | Note: inverting a data axis will correspondingly invert the
|
106 | 119 | arrows only with ``angles='xy'``.
|
107 |
| -scale : None, float, optional |
| 120 | +
|
| 121 | +scale : float, optional |
108 | 122 | Number of data units per arrow length unit, e.g., m/s per plot width; a
|
109 | 123 | smaller scale parameter makes the arrow longer. Default is *None*.
|
110 | 124 |
|
111 | 125 | If *None*, a simple autoscaling algorithm is used, based on the average
|
112 | 126 | vector length and the number of vectors. The arrow length unit is given by
|
113 |
| - the *scale_units* parameter |
114 |
| -scale_units : [ 'width' | 'height' | 'dots' | 'inches' | 'x' | 'y' | 'xy' ], \ |
115 |
| -None, optional |
| 127 | + the *scale_units* parameter. |
| 128 | +
|
| 129 | +scale_units : {'width', 'height', 'dots', 'inches', 'x', 'y', 'xy'}, optional |
116 | 130 | If the *scale* kwarg is *None*, the arrow length unit. Default is *None*.
|
117 | 131 |
|
118 | 132 | e.g. *scale_units* is 'inches', *scale* is 2.0, and
|
119 | 133 | ``(u,v) = (1,0)``, then the vector will be 0.5 inches long.
|
120 | 134 |
|
121 |
| - If *scale_units* is 'width'/'height', then the vector will be half the |
| 135 | + If *scale_units* is 'width' or 'height', then the vector will be half the |
122 | 136 | width/height of the axes.
|
123 | 137 |
|
124 | 138 | If *scale_units* is 'x' then the vector will be 0.5 x-axis
|
125 | 139 | units. To plot vectors in the x-y plane, with u and v having
|
126 | 140 | the same units as x and y, use
|
127 | 141 | ``angles='xy', scale_units='xy', scale=1``.
|
128 |
| -width : scalar, optional |
| 142 | +
|
| 143 | +width : float, optional |
129 | 144 | Shaft width in arrow units; default depends on choice of units,
|
130 | 145 | above, and number of vectors; a typical starting value is about
|
131 | 146 | 0.005 times the width of the plot.
|
132 |
| -headwidth : scalar, optional |
133 |
| - Head width as multiple of shaft width, default is 3 |
134 |
| -headlength : scalar, optional |
135 |
| - Head length as multiple of shaft width, default is 5 |
136 |
| -headaxislength : scalar, optional |
137 |
| - Head length at shaft intersection, default is 4.5 |
138 |
| -minshaft : scalar, optional |
| 147 | +
|
| 148 | +headwidth : float, optional, default: 3 |
| 149 | + Head width as multiple of shaft width. |
| 150 | +
|
| 151 | +headlength : float, optional, default: 5 |
| 152 | + Head length as multiple of shaft width. |
| 153 | +
|
| 154 | +headaxislength : float, optional, default: 4.5 |
| 155 | + Head length at shaft intersection. |
| 156 | +
|
| 157 | +minshaft : float, optional, default: 1 |
139 | 158 | Length below which arrow scales, in units of head length. Do not
|
140 | 159 | set this to less than 1, or small arrows will look terrible!
|
141 |
| - Default is 1 |
142 |
| -minlength : scalar, optional |
| 160 | +
|
| 161 | +minlength : float, optional, default: 1 |
143 | 162 | Minimum length as a multiple of shaft width; if an arrow length
|
144 | 163 | is less than this, plot a dot (hexagon) of this diameter instead.
|
145 |
| - Default is 1. |
146 |
| -pivot : [ 'tail' | 'mid' | 'middle' | 'tip' ], optional |
147 |
| - The part of the arrow that is at the grid point; the arrow rotates |
148 |
| - about this point, hence the name *pivot*. |
149 |
| -color : [ color | color sequence ], optional |
150 |
| - This is a synonym for the |
151 |
| - :class:`~matplotlib.collections.PolyCollection` facecolor kwarg. |
152 |
| - If *C* has been set, *color* has no effect. |
153 | 164 |
|
154 |
| -Notes |
155 |
| ------ |
156 |
| -Additional :class:`~matplotlib.collections.PolyCollection` |
157 |
| -keyword arguments: |
| 165 | +pivot : {'tail', 'mid', 'middle', 'tip'}, optional, default: 'tail' |
| 166 | + The part of the arrow that is anchored to the *X*, *Y* grid. The arrow |
| 167 | + rotates about this point. |
158 | 168 |
|
159 |
| -%(PolyCollection)s |
| 169 | + 'mid' is a synonym for 'middle'. |
| 170 | +
|
| 171 | +color : color or color sequence, optional |
| 172 | + Explicit color(s) for the arrows. If *C* has been set, *color* has no |
| 173 | + effect. |
| 174 | +
|
| 175 | + This is a synonym for the `~.PolyCollection` *facecolor* parameter. |
| 176 | +
|
| 177 | +Other Parameters |
| 178 | +---------------- |
| 179 | +**kwargs : `~matplotlib.collections.PolyCollection` properties, optional |
| 180 | + All other keyword arguments are passed on to `.PolyCollection`: |
| 181 | +
|
| 182 | + %(PolyCollection)s |
160 | 183 |
|
161 | 184 | See Also
|
162 | 185 | --------
|
163 |
| -quiverkey : Add a key to a quiver plot |
| 186 | +quiverkey : Add a key to a quiver plot. |
164 | 187 | """ % docstring.interpd.params
|
165 | 188 |
|
166 | 189 | _quiverkey_doc = """
|
|
0 commit comments