目录
第一部分:画图规范
一.注释(annotate)
import matplotlib.pyplot as plt
import numpy as np
x = np.arange(-10,11,1)
plt.plot(x,x*x)
plt.annotate(s='the bottom',xy=(0,1),xytext=(0,20),
arrowprops={
'facecolor':'blue','headlength':8,'headwidth':10,'width':5})
plt.show()
plt.annotate()----添加注释,s–注释标签,xy–头部位置,xytext–标签位置;
annotate()中注释采用箭头:给arrowprops字典赋值,facecolor–颜色,headlength–箭头部分长度,headwidth–箭头部分宽度,width–箭头身宽。
二.文字插入(text)
import matplotlib.pyplot as plt
import numpy as np
x = np.arange(-10,11,1)
plt.plot(x,x*x)
plt.text(x=-4,y=40,s='function:y=x*x',family='fantasy',size=20,color='green',
style='italic',weight=1000,bbox={
'facecolor'