欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

line plot

程序员文章站 2022-07-13 11:04:25
...
import matplotlib.pyplot as plt
from numpy.random import randn
plt.style.use('ggplot')
plot_data1=randn(50).cumsum()
plot_data2=randn(50).cumsum()
plot_data3=randn(50).cumsum()
plot_data4=randn(50).cumsum()
fig=plt.figure(1,figsize=(10,8),facecolor="white")
ax=fig.add_subplot(1,1,1)
ax.spines["left"].set_color("white")
ax.spines["bottom"].set_color("white")
ax.plot(plot_data1,marker=r'o',markersize=4,markeredgecolor='black',color=u'blue',linestyle='-',label='Blue Solid')
ax.plot(plot_data2,marker=r'+',color=u'red',linestyle='--',label='Red Dash')
ax.plot(plot_data3,marker=r'*',color=u'green',linestyle='-.',label='Green Dash Dot')
ax.plot(plot_data4,marker=r's',color=u'orange',linestyle=':',label='Orange Dotted')
ax.xaxis.set_ticks_position('bottom')
ax.yaxis.set_ticks_position('left')
plt.title('Line Plots:Markers,Colors,and Linestyles')
plt.xlabel('Draw')
plt.ylabel('Random Number')
plt.legend(loc='best')
plt.grid()
plt.savefig('E:\python\慕课网 python\.idea\photo\line_plot.png',dpi=400,bbox_inches='tight')
plt.show()

line plot