第81页 4 Advanced Matplotlib
孔明 (Find it yourself.)
- 章节名:4 Advanced Matplotlib
- 页码:第81页
使用Matplotlib的三种方式: 1,pyplot: 提供与Matlab类似的函数式环境,state-machine interface。通常用于interactive ploting的模式,例如ipython,可立即看到绘图结果。 使用方式如下:from matplotlib import pyplot as plt pyplot中提供的函数接口见:http://matplotlib.org/api/pyplot_api.html#pyplot 2,pylab:结合了pyplot(用于作图)和numpy(用于数学计算)。在本书中被嫌弃。 使用方式如下:ipython -pylab 3,面向对象式的。 举例:
import matplotlib.pyplot as plt import numpy as np x = np.arange(0, 10, 0.1) y = np.random.randn(len(x)) fig = plt.figure() ax = fig.add_subplot(111) l, = plt.plot(x, y) t = ax.set_title('random numbers') plt.show()
38人阅读
说明 · · · · · ·
表示其中内容是对原文的摘抄