本文簡要介紹 python 語言中mpl_toolkits.axes_grid1.anchored_artists.AnchoredDirectionArrows
的用法。
-
畫兩個垂直的箭頭來指示方向。
- 參數:
- transform
Transform
-
正在使用的坐標係的變換對象,即
matplotlib.axes.Axes.transAxes
。 - label_x, label_y str
-
x 和 y 箭頭的標簽文本
- length 浮點數,默認值:0.15
-
箭頭的長度,以
transform
的坐標給出。 - fontsize 浮點數,默認:0.08
-
標簽字符串的大小,以
transform
的坐標給出。 - loc str,默認值:'upper left'
-
箭頭的位置。有效位置為'upper left'、'upper center'、'upper right'、'center left'、'center'、'center right'、'lower left'、'lower center'、'lower right'。為了向後兼容,也接受數值。詳情請參見
Legend
的參數loc
。 - angle 浮點數,默認值:0
-
箭頭的角度,以度為單位。
- aspect_ratio 浮點數,默認值:1
-
arrow_x 和 arrow_y 的長度之比。負數可用於改變方向。
- pad 浮點數,默認值:0.4
-
標簽和箭頭周圍的填充,以字體大小的一小部分。
- borderpad 浮點數,默認值:0.4
-
邊框填充,以字體大小的分數表示。
- frameon 布爾值,默認值:假
-
如果為 True,請在箭頭和標簽周圍畫一個框。
- color str,默認值:'white'
-
箭頭和標簽的顏色。
- alpha 浮點數,默認值:1
-
箭頭和標簽的 Alpha 值
- sep_x, sep_y 浮點數,默認值:分別為 0.01 和 0
-
transform
坐標中的箭頭和標簽之間的分隔。 - fontproperties
FontProperties
,可選 -
標簽文本的字體屬性。
- back_length 浮點數,默認值:0.15
-
箭頭交叉點後麵的箭頭分數。
- head_width 浮點數,默認值:10
-
箭頭寬度,發送至
ArrowStyle
。 - head_length 浮點數,默認值:15
-
箭頭長度,發送到
ArrowStyle
。 - tail_width 浮點數,默認值:2
-
箭尾寬度,發送至
ArrowStyle
。 - text_props, arrow_props dict
-
文本和箭頭的屬性,傳遞給
TextPath
和FancyArrowPatch
。 - **kwargs
-
關鍵字參數轉發到
AnchoredOffsetbox
。
- transform
注意
如果
prop
作為關鍵字參數傳遞,但fontproperties
不是,則prop
被假定為預期的fontproperties
。不支持同時使用prop
和fontproperties
。例子
>>> 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
FancyArrowPatch
-
箭頭 x 和 y
- text_path_x, text_path_y
TextPath
-
箭頭標簽的路徑
- p_x, p_y
PathPatch
-
箭頭標簽補丁
- box
AuxTransformBox
-
箭頭和標簽的容器。
- arrow_x, arrow_y
用法
class mpl_toolkits.axes_grid1.anchored_artists.AnchoredDirectionArrows(transform, label_x, label_y, length=0.15, fontsize=0.08, loc='upper left', 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)
相關用法
- Python matplotlib AnchoredDrawingArea用法及代碼示例
- Python matplotlib AnchoredAuxTransformBox用法及代碼示例
- Python matplotlib AnchoredSizeBar用法及代碼示例
- Python matplotlib Axes.get_legend_handles_labels用法及代碼示例
- Python matplotlib AbstractMovieWriter用法及代碼示例
- Python matplotlib Axes.hist用法及代碼示例
- Python matplotlib Axes.step用法及代碼示例
- Python matplotlib Axes.contour用法及代碼示例
- Python matplotlib Axes.plot用法及代碼示例
- Python matplotlib Axes.semilogx用法及代碼示例
- Python matplotlib Axes.semilogy用法及代碼示例
- Python matplotlib Axes.inset_axes用法及代碼示例
- Python matplotlib Axes.axis用法及代碼示例
- Python matplotlib AutoDateFormatter用法及代碼示例
- Python matplotlib Axes.barbs用法及代碼示例
- Python matplotlib Axes.tripcolor用法及代碼示例
- Python matplotlib AsteriskPolygonCollection用法及代碼示例
- Python matplotlib Affine2D.set_matrix用法及代碼示例
- Python matplotlib AxisArtist.toggle用法及代碼示例
- Python matplotlib Axis.get_tick_params用法及代碼示例
- Python matplotlib Axes.set_prop_cycle用法及代碼示例
- Python matplotlib ArrowStyle用法及代碼示例
- Python matplotlib Axes.axline用法及代碼示例
- Python matplotlib Axes.tick_params用法及代碼示例
- Python matplotlib Axes.axvspan用法及代碼示例
注:本文由純淨天空篩選整理自skytowner.com大神的英文原創作品 mpl_toolkits.axes_grid1.anchored_artists.AnchoredDirectionArrows。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。