Advertisement

Python绘图——折线图

阅读量:

带有虚线背景的折线图

复制代码
    from pylab import *
    mpl.rcParams['font.sans-serif'] = ['SimHei']
    
    x=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26]
    y=[900, 1080, 1800, 3060, 4680, 2880, 5040, 4140, 5580, 5040, 4860, 3780,
       3420, 4860, 3780, 4860, 5220, 4860, 3600,5760, 3600, 1620, 1260, 1080, 1300, 1700]
    fig=plt.figure(figsize=(12,8))
    ax = fig.add_subplot(111)
    plt.ylim((500, 6500))
    my_y_ticks = np.arange(500, 6500.01,1000)
    plt.yticks(my_y_ticks)
    plt.plot(x,y,color='b',linewidth=2,marker='.',
    markersize=

全部评论 (0)

还没有任何评论哟~