画注释:

画注释
import numpy as np
import matplotlib.pyplot as plt
import matplotlib as mpl
import datetime

#解决能显示中文
plt.rcParams['font.sans-serif']=['SimHei'] #指定默认字体 SimHei为黑体
plt.rcParams['axes.unicode_minus']=False #用来正常显示负号

fig=plt.figure()  #定义第一个图纸
x=np.arange(-10,11,1)
y=x**2
ax = fig.add_subplot(1,1,1)
ax.plot(x,y)
ax.annotate('这是底部',xy=(0,1),xytext=(0,20),arrowprops=dict(facecolor='y',shrink=0.08,frac=0.1,headwidth=10,width=5))  #画注释
#箭头是从xytext的坐标画到xy的坐标
#参数1 注释文字        #参数2 xy 箭头的坐标     #参数3 xytext 注释文字的起始坐标
#facecolor='y'    设置颜色
#shrink=0.08    <1   箭头收缩比,离文字的距离
#frac=0.1   箭头头部所占据的比例   ?????
#headwidth=10   箭头头部的宽度,以点为单位
#width=5   箭身宽度


plt.show()
画注释

还有高级注释,请看 https://blog.csdn.net/wizardforcel/article/details/54782628 

 

相关文章:

  • 2021-12-09
  • 2021-11-28
  • 2021-12-25
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-04
  • 2021-12-29
猜你喜欢
  • 2021-07-19
  • 2021-11-10
  • 2021-11-18
  • 2021-09-24
  • 2022-01-19
  • 2021-08-15
  • 2021-08-07
相关资源
相似解决方案