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 画图加坐标 加点 加网格》对你有帮助,请点赞、收藏,并留下你的观点哦!