图形中添加注释(annotate)
2016-12-04 15:43
148 查看
在图形中添加注释,主要是起到提示作用
#!/usr/bin/python
#coding: utf-8
import numpy as np
import matplotlib.pyplot as plt
x = np.arange(-10, 11, 1)
y = x * x
plt.plot(x, y)
# 添加注释
# 第一个参数是注释的内容
# xy设置箭头尖的坐标
# xytext设置注释内容显示的起始位置
# arrowprops 用来设置箭头
# facecolor 设置箭头的颜色
# headlength 箭头的头的长度
# headwidth 箭头的宽度
# width 箭身的宽度
plt.annotate(u"This is a zhushi", xy = (0, 1), xytext = (-4, 50),\
arrowprops = dict(facecolor = "r", headlength = 10, headwidth = 30, width = 20))
# 可以通过设置xy和xytext中坐标的值来设置箭身是否倾斜
plt.show()
#!/usr/bin/python
#coding: utf-8
import numpy as np
import matplotlib.pyplot as plt
x = np.arange(-10, 11, 1)
y = x * x
plt.plot(x, y)
# 添加注释
# 第一个参数是注释的内容
# xy设置箭头尖的坐标
# xytext设置注释内容显示的起始位置
# arrowprops 用来设置箭头
# facecolor 设置箭头的颜色
# headlength 箭头的头的长度
# headwidth 箭头的宽度
# width 箭身的宽度
plt.annotate(u"This is a zhushi", xy = (0, 1), xytext = (-4, 50),\
arrowprops = dict(facecolor = "r", headlength = 10, headwidth = 30, width = 20))
# 可以通过设置xy和xytext中坐标的值来设置箭身是否倾斜
plt.show()
相关文章推荐
- 为JavaScript程序添加客户端不可见的注释
- 视音频技术零基础学习笔记(四)及解码程序添加注释
- eclipse 中自动添加注释
- Fortran添加多行注释
- vc2008 中使用宏来添加注释的步骤
- zend studio自动添加文件注释和方法注释
- 如何在Eclipse中如何自动添加注释和自定义注释风格
- (add comment to table or column,and add comment to ddl script) erwin为ddl script 脚本添加表或字段的注释(导出注释)(comment)
- eclipse为方法添加注释的快捷键是什么
- python中添加中文注释
- PowerDesigner的PDM图形窗口中显示数据列的中文注释
- zabbix添加cpu使用率图形监控
- eclipse创建java类时自动添加注释
- Eclipse中自动添加注释(作者,时间)
- eclipse自动添加作者、日期等注释
- 如何在sql语句里添加注释
- PowerDesigner将name自动添加到Comment注释的方法 VB代码
- ubuntu Linux图形启动中添加root登录
- Visual Studio+VAssistX自动添加注释,函数头注释,文件头注释
- oracle中创建表时添加注释