Python数据简单处理

##Python数据简单处理 import numpy as np ''' a=np.array([1,1,2,3,4]) c=np.arange(4) d=np.linspace(1,6,4); print(d) ''' import matplotlib.pyplot as plt x = np.linspace(-5, 5, 100) y1 = np.sin(x) y2 = np.cos(x) #创建figure窗口 plt.figure(num=3, figsize=(8, 5)) #画曲线1 plt.plot(x, y1) #画曲线2 plt.plot(x, y2, color='red', linewidth=5.0, linestyle='--') #设置坐标轴范围 plt.xlim((-5, 5)) plt.ylim((-2, 2)) #设置坐标轴名称 plt.xlabel('xxxxxxxxxxx') plt.ylabel('yyyyyyyyyyy') #设置坐标轴刻度 my_x_ticks = np.arange(-5, 5, 0.5) my_y_ticks = np.arange(-2, 2, 0.3) plt.xticks(my_x_ticks) plt.yticks(my_y_ticks) plt.title("title") plt.legend(['4','6'])

猜你喜欢

转载自www.cnblogs.com/Archerme/p/10585315.html