mpl_toolkits.axes_grid1.anchored_artists.AnchoredDirectionArrows¶
-
class
mpl_toolkits.axes_grid1.anchored_artists.
AnchoredDirectionArrows
(transform, label_x, label_y, length=0.15, fontsize=0.08, loc=2, angle=0, aspect_ratio=1, pad=0.4, borderpad=0.4, frameon=False, color='w', alpha=1, sep_x=0.01, sep_y=0, fontproperties=None, back_length=0.15, head_width=10, head_length=15, tail_width=2, text_props=None, arrow_props=None, **kwargs)[源代码]¶ 基类:
matplotlib.offsetbox.AnchoredOffsetbox
画两个垂直箭头指示方向。
参数: - 转型 :
matplotlib.transforms.Transform
matplotlib.transforms.Transform
正在使用的坐标系的转换对象,即,
matplotlib.axes.Axes.transAxes
.- label_x, label_ySTR
X和Y箭头的标签文本
- length浮动,默认值:0.15
箭头的长度,以坐标表示 转型 .
- fontsize浮动,默认值:0.08
标签字符串的大小,以坐标表示 转型 .
- locint,默认值:2
方向箭头的位置。有效的位置代码为:
'upper right' : 1, 'upper left' : 2, 'lower left' : 3, 'lower right' : 4, 'right' : 5, 'center left' : 6, 'center right' : 7, 'lower center' : 8, 'upper center' : 9, 'center' : 10
- angle浮点,默认值:0
箭头的角度(度)。
- aspect_ratio浮点,默认值:1
箭头x和箭头y的长度之比。负数可以用来改变方向。
- pad浮动,默认值:0.4
在标签和箭头周围填充,以字体大小的分数表示。
- borderpad浮动,默认值:0.4
边框填充,以字体大小的分数表示。
- frameonbool,默认值:False
如果为True,请围绕箭头和标签绘制一个框。
- colorstr,默认值:“白色”
箭头和标签的颜色。
- alpha浮点,默认值:1
箭头和标签的Alpha值
- sep_x, sep_y浮动,默认值:分别为0.01和0
箭头和标签之间的坐标分隔 转型 .
- 字体属性 :
matplotlib.font_manager.FontProperties
可选matplotlib.font_manager.fontproperties,可选 标签文本的字体属性。
- back_length浮动,默认值:0.15
箭头交叉点后面箭头的分数。
- head_width浮点,默认值:10
箭头的宽度,发送到箭头样式。
- head_length浮动,默认值:15
箭头的长度,发送到箭头样式。
- tail_width浮动,默认值:2
箭头尾的宽度,发送到箭头样式。
- text_props, arrow_props双关语
传递到的文本和箭头的属性
textpath.TextPath
和patches.FancyArrowPatch
.- **kwargs
要传递给的关键字参数
matplotlib.offsetbox.AnchoredOffsetbox
.
笔记
如果 prop 作为关键字参数传递,但 字体属性 不是,那么 prop 假定为预期 字体属性 . 同时使用 prop 和 字体属性 不支持。
实例
>>> import matplotlib.pyplot as plt >>> import numpy as np >>> from mpl_toolkits.axes_grid1.anchored_artists import ( ... AnchoredDirectionArrows) >>> fig, ax = plt.subplots() >>> ax.imshow(np.random.random((10, 10))) >>> arrows = AnchoredDirectionArrows(ax.transAxes, '111', '110') >>> ax.add_artist(arrows) >>> fig.show()
使用几个可选参数,创建向下箭头和高对比度文本标签。
>>> import matplotlib.font_manager as fm >>> fontprops = fm.FontProperties(family='monospace') >>> arrows = AnchoredDirectionArrows(ax.transAxes, 'East', 'South', ... loc='lower left', color='k', ... aspect_ratio=-1, sep_x=0.02, ... sep_y=-0.01, ... text_props={'ec':'w', 'fc':'k'}, ... fontproperties=fontprops)
属性: - arrow_x, arrow_y :
matplotlib.patches.FancyArrowPatch
matplotlib.patches.FancyArrowPatch
箭头X和Y
- text_path_x, text_path_y :
matplotlib.textpath.TextPath
matplotlib.textpath.TextPath
箭头标签路径
- p_x, p_y :
matplotlib.patches.PathPatch
matplotlib.patches.PathPatch
箭头标签补丁
- box :
matplotlib.offsetbox.AuxTransformBox
matplotlib.offsetbox.AuxTransformBox
箭头和标签的容器。
-
__init__
(transform, label_x, label_y, length=0.15, fontsize=0.08, loc=2, angle=0, aspect_ratio=1, pad=0.4, borderpad=0.4, frameon=False, color='w', alpha=1, sep_x=0.01, sep_y=0, fontproperties=None, back_length=0.15, head_width=10, head_length=15, tail_width=2, text_props=None, arrow_props=None, **kwargs)[源代码]¶ 画两个垂直箭头指示方向。
参数: - 转型 :
matplotlib.transforms.Transform
matplotlib.transforms.Transform
正在使用的坐标系的转换对象,即,
matplotlib.axes.Axes.transAxes
.- label_x, label_ySTR
X和Y箭头的标签文本
- length浮动,默认值:0.15
箭头的长度,以坐标表示 转型 .
- fontsize浮动,默认值:0.08
标签字符串的大小,以坐标表示 转型 .
- locint,默认值:2
方向箭头的位置。有效的位置代码为:
'upper right' : 1, 'upper left' : 2, 'lower left' : 3, 'lower right' : 4, 'right' : 5, 'center left' : 6, 'center right' : 7, 'lower center' : 8, 'upper center' : 9, 'center' : 10
- angle浮点,默认值:0
箭头的角度(度)。
- aspect_ratio浮点,默认值:1
箭头x和箭头y的长度之比。负数可以用来改变方向。
- pad浮动,默认值:0.4
在标签和箭头周围填充,以字体大小的分数表示。
- borderpad浮动,默认值:0.4
边框填充,以字体大小的分数表示。
- frameonbool,默认值:False
如果为True,请围绕箭头和标签绘制一个框。
- colorstr,默认值:“白色”
箭头和标签的颜色。
- alpha浮点,默认值:1
箭头和标签的Alpha值
- sep_x, sep_y浮动,默认值:分别为0.01和0
箭头和标签之间的坐标分隔 转型 .
- 字体属性 :
matplotlib.font_manager.FontProperties
可选matplotlib.font_manager.fontproperties,可选 标签文本的字体属性。
- back_length浮动,默认值:0.15
箭头交叉点后面箭头的分数。
- head_width浮点,默认值:10
箭头的宽度,发送到箭头样式。
- head_length浮动,默认值:15
箭头的长度,发送到箭头样式。
- tail_width浮动,默认值:2
箭头尾的宽度,发送到箭头样式。
- text_props, arrow_props双关语
传递到的文本和箭头的属性
textpath.TextPath
和patches.FancyArrowPatch
.- **kwargs
要传递给的关键字参数
matplotlib.offsetbox.AnchoredOffsetbox
.
笔记
如果 prop 作为关键字参数传递,但 字体属性 不是,那么 prop 假定为预期 字体属性 . 同时使用 prop 和 字体属性 不支持。
实例
>>> import matplotlib.pyplot as plt >>> import numpy as np >>> from mpl_toolkits.axes_grid1.anchored_artists import ( ... AnchoredDirectionArrows) >>> fig, ax = plt.subplots() >>> ax.imshow(np.random.random((10, 10))) >>> arrows = AnchoredDirectionArrows(ax.transAxes, '111', '110') >>> ax.add_artist(arrows) >>> fig.show()
使用几个可选参数,创建向下箭头和高对比度文本标签。
>>> import matplotlib.font_manager as fm >>> fontprops = fm.FontProperties(family='monospace') >>> arrows = AnchoredDirectionArrows(ax.transAxes, 'East', 'South', ... loc='lower left', color='k', ... aspect_ratio=-1, sep_x=0.02, ... sep_y=-0.01, ... text_props={'ec':'w', 'fc':'k'}, ... fontproperties=fontprops)
属性: - arrow_x, arrow_y :
matplotlib.patches.FancyArrowPatch
matplotlib.patches.FancyArrowPatch
箭头X和Y
- text_path_x, text_path_y :
matplotlib.textpath.TextPath
matplotlib.textpath.TextPath
箭头标签路径
- p_x, p_y :
matplotlib.patches.PathPatch
matplotlib.patches.PathPatch
箭头标签补丁
- box :
matplotlib.offsetbox.AuxTransformBox
matplotlib.offsetbox.AuxTransformBox
箭头和标签的容器。
- 转型 :
-
__module__
= 'mpl_toolkits.axes_grid1.anchored_artists'¶
- 转型 :