绘图的推荐途径是 matplotlib 还是 pylab?
pylab 模块是在一个名称空间中导入 matplotlib.pyplot(用于绘图)和 numpy(用于数学和数组运算)。
尽管很多示例使用 pylab,但不再建议使用。对于非交互性绘图,建议使用 pyplot 创建图形,然后使用面向对象接口绘图。
示例
import matplotlib.pyplot as plt
import numpy as np
x = np.linspace(0, 2, 100)
plt.plot(x, x, label='linear')
plt.plot(x, x**2, label='quadratic')
plt.plot(x, x**3, label='cubic')
plt.xlabel('x label')
plt.ylabel('y label')
plt.title("Simple Plot")
plt.legend()
plt.show()输出

广告
数据结构
网络
RDBMS
操作系统
Java
iOS
HTML
CSS
Android
Python
C 编程
C++
C#
MongoDB
MySQL
Javascript
PHP