失眠网,内容丰富有趣,生活中的好帮手!
失眠网 > Python 画图加坐标 加点 加网格

Python 画图加坐标 加点 加网格

时间:2019-06-25 06:37:52

相关推荐

Python 画图加坐标 加点 加网格

import matplotlib.pyplot as plty= read_predictdatas('文件名.csv') #这里的read_predictdatas函数是自己写的,用来读取数据y = origianl- predictdatasx = [i for i in range(len(difference))]#给每个点加坐标for a, b in zip(i, difference):plt.text(a, b, (a, b), ha='center', va='bottom', fontsize=10)#显示网格plt.grid(True) #加点,设置点的颜色为红色plt.plot(x, y, marker='o', markerfacecolor='red')#画散点图plt.scatter(x, y, marker='o'')plt.show()

加水平和垂直的线

vlines(x, ymin, ymax)

hlines(y, xmin, xmax)

plt.vlines(0, 0, 0.5, colors = "r", linestyles = "dashed")

画子图

plt.plot(2,2,1)plt.plot(2,2,2)plt.plot(2,1,2)plt.show()

画子图参考链接

如果觉得《Python 画图加坐标 加点 加网格》对你有帮助,请点赞、收藏,并留下你的观点哦!

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。