python画图加注释python画图笔记——注释
注释简介注释位于
matplotlib.pyplot
下,需要需要实例化后再
在画布上填写注释
import
matplotlib.pyplot
as
plt
fig=plt.figure()
ax=fig.add_subplot(1,1,1)
注释有三种,分别为
ax.text()
:文本注释,只能填写文本
ax.arrow()
:箭头标记,不能填写文本
ax.annotate()
:箭头注释,在箭头的位置可以
填写文本二
.
参数解释
1.texttext(x, y, s, fontdict=None, withdash=False, **kwargs) x,y
:
注释的坐标位置(标量)
s
:注释的内容(字符串)
fontdict
:重新设置注释内容的
文本格式,包括字体颜色、背景大小和颜色、字体大小等(字典)
withdash
:创建
一个替代注释内容
“s”
的对象,参照英文单词解释,这应该是一个破折号
**kwargs
包括
| agg_filter: unknown | alpha: float (0.0 transparent through 1.0 opaque)
| animated:
[True | False]
| axes: an :class:~matplotlib.axes.Axes
instance
| backgroundcolor: any
matplotlib
color
|
bbox:
FancyBboxPatch
prop
dict
|
clip_box:
a
:class:matplotlib.transforms.Bbox
instance
|
clip_on:
[True
|
False]
|
clip_path:
[
(:class:~matplotlib.path.Path
,
:class:~matplotlib.transforms.Transform
)
| :class:~matplotlib.patches.Patch
| None ]
| color: any matplotlib color
| contains: a
callable function
| family or fontfamily or fontname or name: [FONTNAME | ‘serif’ |
‘sans-serif’
|
‘cursive’
|
‘fantasy’
|
‘monospace’
]
|
figure:
a
:class:matplotlib.figure.Figure
instance
|
fontproperties
or
font_properties:
a
:class:matplotlib.font_manager.FontProperties
instance
|
gid:
an
id
string
|
horizontalalignment or ha: [ ‘center’ | ‘right’ | ‘left’ ]
| label: string or anything printable
with
‘%s’
conversion.
|
linespacing:
float
(multiple
of
font
size)
|
multialignment:
[‘left’ | ‘right’ | ‘center’ ]
| path_effects: unknown | picker: [None|float|boolean|callable]
|
position:
(x,y)
|
rasterized:
[True
|
False
|
None]
|
rotation:
[
angle
in
degrees
|
‘vertical’ | ‘horizontal’ ]
| rotation_mode: unknown | size or fontsize: [size in points | ‘xx-
small’ | ‘x-small’ | ‘small’ | ‘medium’ | ‘large’ | ‘x-large’ | ‘xx-large’ ]
| sketch_params: