一、安装

此处以Ubuntu12.04为例:

$ sudo apt-get install ipython python-matplotlib python-numpy

二、简单实例

>>> import matplotlib.pyplot as plt
>>>
>>> plt.figure(1) # 创建图表1 <matplotlib.figure.Figure object at 0x26fda10> >>> plt.figure(2) # 创建图表2 <matplotlib.figure.Figure object at 0x2a5f610> >>> ax1 = plt.subplot(211) # 在图表2中创建子图1 >>> ax2 = plt.subplot(212) # 在图表2中创建子图2 >>> x = np.linspace(0, 3, 100) >>> plt.figure(1) # 选择图表1 <matplotlib.figure.Figure object at 0x26fda10> >>> plt.plot(x, np.exp(x/3)) [<matplotlib.lines.Line2D object at 0x36383d0>] >>> plt.sca(ax1) # 选择图表2的子图1 >>> plt.plot(x, np.sin(x)) [<matplotlib.lines.Line2D object at 0x3638890>] >>> plt.sca(ax2) # 选择图表2的子图2 >>> plt.plot(x, np.sin(2*x)) [<matplotlib.lines.Line2D object at 0x3638dd0>] >>> plt.show()

【Python】画图——使用matplotlib在python中画图

三、画MDCT正反变化图

四、参考

http://www.cnblogs.com/wei-li/archive/2012/05/23/2506940.html

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-10-11
  • 2022-12-23
  • 2022-01-10
  • 2021-11-20
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-06-25
  • 2022-02-04
  • 2021-12-24
  • 2022-01-02
  • 2021-06-09
  • 2022-12-23
相关资源
相似解决方案