莫烦-matplotlib学习笔记(一)

来源:互联网 发布:淘宝客定向计划怎么写 编辑:程序博客网 时间:2024/05/22 06:55
参考莫烦教学视频:https://morvanzhou.github.io/tutorials/data-manipulation/plt/2-2-figure/
import matplotlib.pyplot as pltimport numpy as npx = np.linspace(-3, 3, 50)y1=2*x + 1y2 = x**2plt.figure()#matplotlib 的 figure 就是一个 单独的 figure 小窗口plt.plot(x, y1)#在figure1里显示x-y1#plt.figure(num=2, figsize=(8, 5))  #指定figure窗口序号和大小plt.plot(x, y2)#在figure2里显示x-y2## plot the second curve in this figure with certain parametersplt.figure()#在figure3里显示x-y1和x-y2两条线plt.plot(x, y1, color='red', linewidth=1.0, linestyle='--')plt.plot(x, y2)plt.show()

原创粉丝点击