matplotlib.quiver.Barbs¶
-
class
matplotlib.quiver.
Barbs
(ax, *args, pivot='tip', length=7, barbcolor=None, flagcolor=None, sizes=None, fill_empty=False, barb_increments=None, rounding=True, flip_barb=False, **kw)[源代码]¶ 基类:
matplotlib.collections.PolyCollection
倒刺专用多集合。
唯一的API方法是
set_UVC()
,可用于更改箭头的大小、方向和颜色。使用更改位置set_offsets()
收集方法。这个方法可能在动画中有用。有一个内部功能
_find_tails()
在矢量大小的情况下,可以精确地找到倒钩上应该放什么。从那里_make_barbs()
用于根据此信息查找多边形的顶点以表示倒钩。绘制一个二维倒钩区域。
呼叫签名:
barbs([X, Y], U, V, [C], **kw)
哪里 X , Y 确定倒钩位置, U , V 定义倒钩方向,以及 C 可以选择设置颜色。
所有参数可以是1D或2D。 U , V , C 可以是蒙面数组,但可以是蒙面数组 X , Y 目前不支持。
在气象学中,通常使用倒钩来绘制风观测的速度和方向,但在技术上可以用来绘制任何二维矢量量。与按箭头长度给出矢量大小的箭头不同,倒钩通过放置斜线或三角形以各种大小增量提供关于矢量大小的更多定量信息,如下图所示:
: /\ \ : / \ \ : / \ \ \ : / \ \ \ : ------------------------------
最大增量由三角形(或“标志”)给出。之后是完整的线条(倒钩)。最小的增量是半行。当然,最多只有1条半线。如果大小很小,只需要一条半直线,而不需要整条直线或三角形,则半直线将从倒钩末端偏移,这样就可以很容易地将其与具有一条整条直线的倒钩区分开来。上面显示的倒钩的大小名义上是65,使用50、10和5的标准增量。
另请参见https://en.wikipedia.org/wiki/Wind_barb。
参数: - X, Y一维或二维阵列,可选
倒钩位置的x和y坐标。看到了吗 枢轴 倒钩是怎么被拉到x,y位置的。
如果没有给出,它们将根据 U 和 V .
如果 X 和 Y 是1D但是 U , V 是二维的, X , Y 使用
X, Y = np.meshgrid(X, Y)
. 在这种情况下len(X)
和len(Y)
必须匹配的列和行维度 U 和 V .- U, V一维或二维阵列
倒钩轴的x和y组件。
- C一维或二维阵列,可选
通过colormapping定义倒钩颜色的数值数据 norm 和 cmap .
这不支持显式颜色。如果要直接设置颜色,请使用 芭比色 相反。
- length浮点,默认值:7
倒钩的长度(以点为单位);倒钩的其他部分按比例缩放。
- pivot{'tip'、'middle'}或float,默认值为:“tip”
锚定到的箭头部分 X , Y 网格。倒钩围绕这一点旋转。这也可以是一个数字,它将倒钩的起点从网格点移开许多点。
- barbcolor颜色或颜色顺序
除旗帜外,倒钩所有部分的颜色。此参数类似于 变色染料 多边形的参数,可以使用。但是,此参数将覆盖facecolor。
- flagcolor颜色或颜色顺序
倒钩上任何旗帜的颜色。此参数类似于 脸色 参数,可以改为使用。但是,此参数将覆盖facecolor。如果未设置(和 C 也没有)那么 旗舰色彩 将设置为匹配 芭比色 使倒钩具有均匀的颜色。如果 C 已经被设定, 旗舰色彩 没有效果。
- sizes可选的
一种系数词典,规定给定特征与倒钩长度之比。只需要包括希望覆盖的那些值。这些功能包括:
- “间距”-功能之间的间距(标志、全倒钩/半倒钩)
- “高度”-旗或全倒钩的高度(从轴到顶部的距离)
- “宽度”-标志的宽度,是完整倒钩宽度的两倍
- “EmptyBarb”-用于低震级的圆半径
- fill_emptybool,默认值:False
所画的空倒钩(圆)是否应填充国旗颜色。如果没有填充,则中心是透明的。
- roundingbool,默认值:True
在分配倒钩分量时是否应舍入矢量幅值。如果为真,则将幅值舍入为半倒钩增量的最接近倍数。如果为False,则幅值将被截断为下一个最低的倍数。
- barb_increments可选的
指定与倒钩的不同部分关联的值的增量字典。只需要包括希望覆盖的那些值。
- “半”-半倒钩(默认为5)
- “完全”-完全倒钩(默认为10)
- “标志”-标志(默认为50)
- flip_barbbool或类似于bool的数组,默认值:False
线条和标志是否应指向法线的相反方向。正常的行为是倒刺和线指向右边(来自于风倒刺,这些特征指向北半球的低压)。
单个值应用于所有倒钩。通过传递一个与 U 和 V .
返回: - 倒钩 :
Barbs
倒钩
其他参数: - **kwargs
倒钩可以进一步定制使用
PolyCollection
关键字参数:财产 描述 agg_filter
一种过滤函数,它接受一个(m,n,3)浮点数组和一个dpi值,并返回一个(m,n,3)数组。 alpha
浮动或无 animated
布尔 antialiased
或者aa或者抗锯齿药布尔或布尔列表 array
恩达雷 capstyle
“对接”、“圆形”、“突出” clim
(V最小:浮动,V最大:浮动) clip_box
Bbox
clip_on
布尔 clip_path
面片或(路径、变换)或无 cmap
Colormap
或str或Nonecolor
rgba元组的颜色或列表 contains
未知的 edgecolor
或ec或edgecolors颜色或颜色列表或“面” facecolor
或者facecolors或者fc颜色或颜色列表 figure
Figure
gid
STR hatch
'/'、''、''、'-'、'+'、'X'、'O'、'O'、'、'、'*' in_layout
布尔 joinstyle
'miter'、'round'、'bevel' label
对象 linestyle
或虚线或线型或lsstr或tuple或其列表 linewidth
或线宽或lw浮动或浮动列表 norm
Normalize
或无offset_position
未知的 offsets
类似于(N,2)或(2,) path_effects
AbstractPathEffect
picker
无、布尔或可呼叫 pickradius
未知的 rasterized
布尔或无 sketch_params
(比例:浮动,长度:浮动,随机性:浮动) snap
布尔或无 transform
Transform
url
STR urls
str或None列表 visible
布尔 zorder
浮动
-
__init__
(ax, *args, pivot='tip', length=7, barbcolor=None, flagcolor=None, sizes=None, fill_empty=False, barb_increments=None, rounding=True, flip_barb=False, **kw)[源代码]¶ - 构造函数接受一个必需的参数,一个Axes实例,后跟以下pyplot接口文档中描述的args和kwargs:
绘制一个二维倒钩区域。
呼叫签名:
barbs([X, Y], U, V, [C], **kw)
哪里 X , Y 确定倒钩位置, U , V 定义倒钩方向,以及 C 可以选择设置颜色。
所有参数可以是1D或2D。 U , V , C 可以是蒙面数组,但可以是蒙面数组 X , Y 目前不支持。
在气象学中,通常使用倒钩来绘制风观测的速度和方向,但在技术上可以用来绘制任何二维矢量量。与按箭头长度给出矢量大小的箭头不同,倒钩通过放置斜线或三角形以各种大小增量提供关于矢量大小的更多定量信息,如下图所示:
: /\ \ : / \ \ : / \ \ \ : / \ \ \ : ------------------------------
最大增量由三角形(或“标志”)给出。之后是完整的线条(倒钩)。最小的增量是半行。当然,最多只有1条半线。如果大小很小,只需要一条半直线,而不需要整条直线或三角形,则半直线将从倒钩末端偏移,这样就可以很容易地将其与具有一条整条直线的倒钩区分开来。上面显示的倒钩的大小名义上是65,使用50、10和5的标准增量。
另请参见https://en.wikipedia.org/wiki/Wind_barb。
参数: - X, Y一维或二维阵列,可选
倒钩位置的x和y坐标。看到了吗 枢轴 倒钩是怎么被拉到x,y位置的。
如果没有给出,它们将根据 U 和 V .
如果 X 和 Y 是1D但是 U , V 是二维的, X , Y 使用
X, Y = np.meshgrid(X, Y)
. 在这种情况下len(X)
和len(Y)
必须匹配的列和行维度 U 和 V .- U, V一维或二维阵列
倒钩轴的x和y组件。
- C一维或二维阵列,可选
通过colormapping定义倒钩颜色的数值数据 norm 和 cmap .
这不支持显式颜色。如果要直接设置颜色,请使用 芭比色 相反。
- length浮点,默认值:7
倒钩的长度(以点为单位);倒钩的其他部分按比例缩放。
- pivot{'tip'、'middle'}或float,默认值为:“tip”
锚定到的箭头部分 X , Y 网格。倒钩围绕这一点旋转。这也可以是一个数字,它将倒钩的起点从网格点移开许多点。
- barbcolor颜色或颜色顺序
除旗帜外,倒钩所有部分的颜色。此参数类似于 变色染料 多边形的参数,可以使用。但是,此参数将覆盖facecolor。
- flagcolor颜色或颜色顺序
倒钩上任何旗帜的颜色。此参数类似于 脸色 参数,可以改为使用。但是,此参数将覆盖facecolor。如果未设置(和 C 也没有)那么 旗舰色彩 将设置为匹配 芭比色 使倒钩具有均匀的颜色。如果 C 已经被设定, 旗舰色彩 没有效果。
- sizes可选的
一种系数词典,规定给定特征与倒钩长度之比。只需要包括希望覆盖的那些值。这些功能包括:
- “间距”-功能之间的间距(标志、全倒钩/半倒钩)
- “高度”-旗或全倒钩的高度(从轴到顶部的距离)
- “宽度”-标志的宽度,是完整倒钩宽度的两倍
- “EmptyBarb”-用于低震级的圆半径
- fill_emptybool,默认值:False
所画的空倒钩(圆)是否应填充国旗颜色。如果没有填充,则中心是透明的。
- roundingbool,默认值:True
在分配倒钩分量时是否应舍入矢量幅值。如果为真,则将幅值舍入为半倒钩增量的最接近倍数。如果为False,则幅值将被截断为下一个最低的倍数。
- barb_increments可选的
指定与倒钩的不同部分关联的值的增量字典。只需要包括希望覆盖的那些值。
- “半”-半倒钩(默认为5)
- “完全”-完全倒钩(默认为10)
- “标志”-标志(默认为50)
- flip_barbbool或类似于bool的数组,默认值:False
线条和标志是否应指向法线的相反方向。正常的行为是倒刺和线指向右边(来自于风倒刺,这些特征指向北半球的低压)。
单个值应用于所有倒钩。通过传递一个与 U 和 V .
返回: - 倒钩 :
Barbs
倒钩
其他参数: - **kwargs
倒钩可以进一步定制使用
PolyCollection
关键字参数:财产 描述 agg_filter
一种过滤函数,它接受一个(m,n,3)浮点数组和一个dpi值,并返回一个(m,n,3)数组。 alpha
浮动或无 animated
布尔 antialiased
或者aa或者抗锯齿药布尔或布尔列表 array
恩达雷 capstyle
“对接”、“圆形”、“突出” clim
(V最小:浮动,V最大:浮动) clip_box
Bbox
clip_on
布尔 clip_path
面片或(路径、变换)或无 cmap
Colormap
或str或Nonecolor
rgba元组的颜色或列表 contains
未知的 edgecolor
或ec或edgecolors颜色或颜色列表或“面” facecolor
或者facecolors或者fc颜色或颜色列表 figure
Figure
gid
STR hatch
'/'、''、''、'-'、'+'、'X'、'O'、'O'、'、'、'*' in_layout
布尔 joinstyle
'miter'、'round'、'bevel' label
对象 linestyle
或虚线或线型或lsstr或tuple或其列表 linewidth
或线宽或lw浮动或浮动列表 norm
Normalize
或无offset_position
未知的 offsets
类似于(N,2)或(2,) path_effects
AbstractPathEffect
picker
无、布尔或可呼叫 pickradius
未知的 rasterized
布尔或无 sketch_params
(比例:浮动,长度:浮动,随机性:浮动) snap
布尔或无 transform
Transform
url
STR urls
str或None列表 visible
布尔 zorder
浮动
-
__module__
= 'matplotlib.quiver'¶
-
barbs_doc
= '\nPlot a 2D field of barbs.\n\nCall signature::\n\n barbs([X, Y], U, V, [C], **kw)\n\nWhere *X*, *Y* define the barb locations, *U*, *V* define the barb\ndirections, and *C* optionally sets the color.\n\nAll arguments may be 1D or 2D. *U*, *V*, *C* may be masked arrays, but masked\n*X*, *Y* are not supported at present.\n\nBarbs are traditionally used in meteorology as a way to plot the speed\nand direction of wind observations, but can technically be used to\nplot any two dimensional vector quantity. As opposed to arrows, which\ngive vector magnitude by the length of the arrow, the barbs give more\nquantitative information about the vector magnitude by putting slanted\nlines or a triangle for various increments in magnitude, as show\nschematically below::\n\n : /\\ \\\n : / \\ \\\n : / \\ \\ \\\n : / \\ \\ \\\n : ------------------------------\n\nThe largest increment is given by a triangle (or "flag"). After those\ncome full lines (barbs). The smallest increment is a half line. There\nis only, of course, ever at most 1 half line. If the magnitude is\nsmall and only needs a single half-line and no full lines or\ntriangles, the half-line is offset from the end of the barb so that it\ncan be easily distinguished from barbs with a single full line. The\nmagnitude for the barb shown above would nominally be 65, using the\nstandard increments of 50, 10, and 5.\n\nSee also https://en.wikipedia.org/wiki/Wind_barb.\n\nParameters\n----------\nX, Y : 1D or 2D array-like, optional\n The x and y coordinates of the barb locations. See *pivot* for how the\n barbs are drawn to the x, y positions.\n\n If not given, they will be generated as a uniform integer meshgrid based\n on the dimensions of *U* and *V*.\n\n If *X* and *Y* are 1D but *U*, *V* are 2D, *X*, *Y* are expanded to 2D\n using ``X, Y = np.meshgrid(X, Y)``. In this case ``len(X)`` and ``len(Y)``\n must match the column and row dimensions of *U* and *V*.\n\nU, V : 1D or 2D array-like\n The x and y components of the barb shaft.\n\nC : 1D or 2D array-like, optional\n Numeric data that defines the barb colors by colormapping via *norm* and\n *cmap*.\n\n This does not support explicit colors. If you want to set colors directly,\n use *barbcolor* instead.\n\nlength : float, default: 7\n Length of the barb in points; the other parts of the barb\n are scaled against this.\n\npivot : {\'tip\', \'middle\'} or float, default: \'tip\'\n The part of the arrow that is anchored to the *X*, *Y* grid. The barb\n rotates about this point. This can also be a number, which shifts the\n start of the barb that many points away from grid point.\n\nbarbcolor : color or color sequence\n The color of all parts of the barb except for the flags. This parameter\n is analogous to the *edgecolor* parameter for polygons, which can be used\n instead. However this parameter will override facecolor.\n\nflagcolor : color or color sequence\n The color of any flags on the barb. This parameter is analogous to the\n *facecolor* parameter for polygons, which can be used instead. However,\n this parameter will override facecolor. If this is not set (and *C* has\n not either) then *flagcolor* will be set to match *barbcolor* so that the\n barb has a uniform color. If *C* has been set, *flagcolor* has no effect.\n\nsizes : dict, optional\n A dictionary of coefficients specifying the ratio of a given\n feature to the length of the barb. Only those values one wishes to\n override need to be included. These features include:\n\n - \'spacing\' - space between features (flags, full/half barbs)\n - \'height\' - height (distance from shaft to top) of a flag or full barb\n - \'width\' - width of a flag, twice the width of a full barb\n - \'emptybarb\' - radius of the circle used for low magnitudes\n\nfill_empty : bool, default: False\n Whether the empty barbs (circles) that are drawn should be filled with\n the flag color. If they are not filled, the center is transparent.\n\nrounding : bool, default: True\n Whether the vector magnitude should be rounded when allocating barb\n components. If True, the magnitude is rounded to the nearest multiple\n of the half-barb increment. If False, the magnitude is simply truncated\n to the next lowest multiple.\n\nbarb_increments : dict, optional\n A dictionary of increments specifying values to associate with\n different parts of the barb. Only those values one wishes to\n override need to be included.\n\n - \'half\' - half barbs (Default is 5)\n - \'full\' - full barbs (Default is 10)\n - \'flag\' - flags (default is 50)\n\nflip_barb : bool or array-like of bool, default: False\n Whether the lines and flags should point opposite to normal.\n Normal behavior is for the barbs and lines to point right (comes from wind\n barbs having these features point towards low pressure in the Northern\n Hemisphere).\n\n A single value is applied to all barbs. Individual barbs can be flipped by\n passing a bool array of the same size as *U* and *V*.\n\nReturns\n-------\nbarbs : `~matplotlib.quiver.Barbs`\n\nOther Parameters\n----------------\n**kwargs\n The barbs can further be customized using `.PolyCollection` keyword\n arguments:\n\n \n .. table::\n :class: property-table\n\n ================================================================================================= =====================================================================================================\n Property Description \n ================================================================================================= =====================================================================================================\n :meth:`agg_filter <matplotlib.artist.Artist.set_agg_filter>` a filter function, which takes a (m, n, 3) float array and a dpi value, and returns a (m, n, 3) array\n :meth:`alpha <matplotlib.artist.Artist.set_alpha>` float or None \n :meth:`animated <matplotlib.artist.Artist.set_animated>` bool \n :meth:`antialiased <matplotlib.collections.Collection.set_antialiased>` or aa or antialiaseds bool or list of bools \n :meth:`array <matplotlib.cm.ScalarMappable.set_array>` ndarray \n :meth:`capstyle <matplotlib.collections.Collection.set_capstyle>` {\'butt\', \'round\', \'projecting\'} \n :meth:`clim <matplotlib.cm.ScalarMappable.set_clim>` (vmin: float, vmax: float) \n :meth:`clip_box <matplotlib.artist.Artist.set_clip_box>` `.Bbox` \n :meth:`clip_on <matplotlib.artist.Artist.set_clip_on>` bool \n :meth:`clip_path <matplotlib.artist.Artist.set_clip_path>` Patch or (Path, Transform) or None \n :meth:`cmap <matplotlib.cm.ScalarMappable.set_cmap>` `.Colormap` or str or None \n :meth:`color <matplotlib.collections.Collection.set_color>` color or list of rgba tuples \n :meth:`contains <matplotlib.artist.Artist.set_contains>` unknown \n :meth:`edgecolor <matplotlib.collections.Collection.set_edgecolor>` or ec or edgecolors color or list of colors or \'face\' \n :meth:`facecolor <matplotlib.collections.Collection.set_facecolor>` or facecolors or fc color or list of colors \n :meth:`figure <matplotlib.artist.Artist.set_figure>` `.Figure` \n :meth:`gid <matplotlib.artist.Artist.set_gid>` str \n :meth:`hatch <matplotlib.collections.Collection.set_hatch>` {\'/\', \'\\\\\', \'|\', \'-\', \'+\', \'x\', \'o\', \'O\', \'.\', \'*\'} \n :meth:`in_layout <matplotlib.artist.Artist.set_in_layout>` bool \n :meth:`joinstyle <matplotlib.collections.Collection.set_joinstyle>` {\'miter\', \'round\', \'bevel\'} \n :meth:`label <matplotlib.artist.Artist.set_label>` object \n :meth:`linestyle <matplotlib.collections.Collection.set_linestyle>` or dashes or linestyles or ls str or tuple or list thereof \n :meth:`linewidth <matplotlib.collections.Collection.set_linewidth>` or linewidths or lw float or list of floats \n :meth:`norm <matplotlib.cm.ScalarMappable.set_norm>` `.Normalize` or None \n :meth:`offset_position <matplotlib.collections.Collection.set_offset_position>` unknown \n :meth:`offsets <matplotlib.collections.Collection.set_offsets>` array-like (N, 2) or (2,) \n :meth:`path_effects <matplotlib.artist.Artist.set_path_effects>` `.AbstractPathEffect` \n :meth:`picker <matplotlib.artist.Artist.set_picker>` None or bool or callable \n :meth:`pickradius <matplotlib.collections.Collection.set_pickradius>` unknown \n :meth:`rasterized <matplotlib.artist.Artist.set_rasterized>` bool or None \n :meth:`sketch_params <matplotlib.artist.Artist.set_sketch_params>` (scale: float, length: float, randomness: float) \n :meth:`snap <matplotlib.artist.Artist.set_snap>` bool or None \n :meth:`transform <matplotlib.artist.Artist.set_transform>` `.Transform` \n :meth:`url <matplotlib.artist.Artist.set_url>` str \n :meth:`urls <matplotlib.collections.Collection.set_urls>` list of str or None \n :meth:`visible <matplotlib.artist.Artist.set_visible>` bool \n :meth:`zorder <matplotlib.artist.Artist.set_zorder>` float \n ================================================================================================= =====================================================================================================\n\n'¶