13 扩展:绘图模块 matplotlib
图形相关模块
import numpy as np
import matplotlib.pyplot as plt
x = np.linspace(0, 10, 1000)
y = np.sin(x) ; z = np.cos(x**2)
plt.figure()
plt.plot(x,y,label="$sin(x)$",color="red",linewidth=2)
plt.plot(x,z,"b--",label="$cos(x^2)$")
plt.legend(loc=3)
plt.show() #保存图像可用 plt.savefig('fig.jpg')
plt.close()
Plot参数
颜色

坐标轴定制
极坐标

图表类型

直方图

散点图

柱状图

多子图
colormap

三维作图

三维曲面

等高线图

三维投影

mplot3d 函数
三维球面


pylab实时动画

动画模块 animation
Last updated