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