matplotlib.pyplot.barbs(*args, data=None, **kw)
[source]
Plot a 2-D field of barbs.
Call signatures:
barb(U, V, **kw) barb(U, V, C, **kw) barb(X, Y, U, V, **kw) barb(X, Y, U, V, C, **kw)
Arguments:
All arguments may be 1-D or 2-D arrays or sequences. If X and Y are absent, they will be generated as a uniform grid. If U and V are 2-D arrays but X and Y are 1-D, and if len(X)
and len(Y)
match the column and row dimensions of U, then X and Y will be expanded with numpy.meshgrid()
.
U, V, C may be masked arrays, but masked X, Y are not supported at present.
Keyword arguments:
A dictionary of coefficients specifying the ratio of a given feature to the length of the barb. Only those values one wishes to override need to be included. These features include:
A dictionary of increments specifying values to associate with different parts of the barb. Only those values one wishes to override need to be included.
Barbs are traditionally used in meteorology as a way to plot the speed and direction of wind observations, but can technically be used to plot any two dimensional vector quantity. As opposed to arrows, which give vector magnitude by the length of the arrow, the barbs give more quantitative information about the vector magnitude by putting slanted lines or a triangle for various increments in magnitude, as show schematically below:
: /\ \\ : / \ \\ : / \ \ \\ : / \ \ \\ : ------------------------------
The largest increment is given by a triangle (or "flag"). After those come full lines (barbs). The smallest increment is a half line. There is only, of course, ever at most 1 half line. If the magnitude is small and only needs a single half-line and no full lines or triangles, the half-line is offset from the end of the barb so that it can be easily distinguished from barbs with a single full line. The magnitude for the barb shown above would nominally be 65, using the standard increments of 50, 10, and 5.
linewidths and edgecolors can be used to customize the barb. Additional PolyCollection
keyword arguments:
Property | Description |
---|---|
agg_filter | a filter function, which takes a (m, n, 3) float array and a dpi value, and returns a (m, n, 3) array |
alpha | float or None |
animated | bool |
antialiased | bool or sequence of bools |
array | ndarray |
capstyle | {'butt', 'round', 'projecting'} |
clim | a length 2 sequence of floats; may be overridden in methods that have vmin and vmax kwargs. |
clip_box | Bbox |
clip_on | bool |
clip_path | [(Path , Transform ) | Patch | None] |
cmap | colormap or registered colormap name |
color | matplotlib color arg or sequence of rgba tuples |
contains | callable |
edgecolor | color or sequence of colors |
facecolor | color or sequence of colors |
figure | Figure |
gid | str |
hatch | {'/', '\', '|', '-', '+', 'x', 'o', 'O', '.', '*'} |
in_layout | bool |
joinstyle | {'miter', 'round', 'bevel'} |
label | object |
linestyle | {'-', '--', '-.', ':', '', (offset, on-off-seq), ...} |
linewidth | float or sequence of floats |
norm | Normalize |
offset_position | {'screen', 'data'} |
offsets | float or sequence of floats |
path_effects | AbstractPathEffect |
picker | None or bool or float or callable |
pickradius | unknown |
rasterized | bool or None |
sketch_params | (scale: float, length: float, randomness: float) |
snap | bool or None |
transform | Transform |
url | str |
urls | List[str] or None |
visible | bool |
zorder | float |
Note
In addition to the above described arguments, this function can take a data keyword argument. If such a data argument is given, the following arguments are replaced by data[<arg>]:
Objects passed as data must support item access (data[<arg>]
) and membership test (<arg> in data
).
matplotlib.pyplot.barbs
© 2012–2018 Matplotlib Development Team. All rights reserved.
Licensed under the Matplotlib License Agreement.
https://matplotlib.org/3.0.0/api/_as_gen/matplotlib.pyplot.barbs.html