line plot

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()

猜你喜欢

转载自blog.csdn.net/qq_42052864/article/details/81708703