赞
踩
- # -*-coding:gb2312-*-
- import matplotlib.pyplot as plt
- import numpy as np
-
- # 中文乱码问题
- plt.rcParams['font.sans-serif']=['SimHei']
- plt.rcParams['axes.unicode_minus']=False
-
-
- x = np.array(['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sept','Oct','Nov','Dec'])
- y1 = np.array([0,0,0,0,0,7896,5235,5235,4569,4568,4562,9564])
- y2 = np.array([2562,2235,2569,2895,1235,2568,2895,2145,2854,1256,2632,1458])
-
- # marker="o",设置断点为实点,markerfacecolor='none'代表线条穿过实点
- plt.plot(x,y1,color="red",marker="o",markerfacecolor='none')
- plt.plot(x,y2,color="black",marker="o",markerfacecolor='none')
-
- # 标注数值
- for a, b in zip(x, y1):
- plt.text(a, b, b, ha='center', va='bottom', fontsize=10)
-
- for a, b in zip(x, y2):
- plt.t
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。