matplotlib添加标注
1、软件安装及运行,见上一篇经验,“用matplotlib画图"
2、输入以下代码,或直接复制粘贴,注意格式import numpy as npimport matplotlib.pyplot as pltax = plt.subplot(111)t = np.arange(0.0, 5., 0.01)s = np.cos(2*np.pi*t)line, = plt.plot(t, s, linewidth = 3)plt.annotate('local max', xy = (2, 1), xytext = (3, 1.5), \arrowprops = dict(facecolor = 'black', shrink = 0.1))plt.ylim(-2, 2)plt.show()
声明:本网站引用、摘录或转载内容仅供网站访问者交流或参考,不代表本站立场,如存在版权或非法内容,请联系站长删除,联系邮箱:site.kefu@qq.com。
阅读量:80
阅读量:70
阅读量:28
阅读量:33
阅读量:80