在python中使用图形库matplotlib

时间:2022-04-29 04:47:02

matplotlib is a python 2D plotting library which produces publication quality figures in a variety of hardcopy formats and interactive environments across platforms. matplotlib can be used in python scripts, the python and ipython shell (ala MATLAB®* or Mathematica®), web application servers, and six graphical user interface toolkits.

简单理解就是一个python 的图形绘制工具

这个工具的创始人已经在2012年因病去世,天妒英才啊。

官网:http://matplotlib.org/

主机:windows10 64bit

python 2.7.10

安装方法:

python -m pip install -U pip setuptools
python -m pip install matplotlib

PS:感谢双11,今天的网络不错,很快就下载安装好了。

安装完成后在目录:(我的py直接安装在c根目录下)

C:\Python27\Lib\site-packages\matplotlib\

  1. Matplotlib 依赖于 Pillow  ,Python官方的一个图形库

https://pypi.python.org/pypi/Pillow

在matplotlib的官网有很多例子可以学习

在部分案例中使用scipy的包,其官网

http://www.scipy.org/

scipy 统计,优化,整合,线性代数模块,傅里叶变换,信号和图像处理,常微分方程求解

核心包:

NumPy SciPy libraryMatplotlibpandasSymPyIPythonnose

安装方法

python -m pip install --upgrade pip
pip install --user numpy scipy matplotlib ipython jupyter pandas sympy nose

我在安装scipy,这个是遇到了错误

看了一下,感觉是:

pip does not work well for Windows because the standard pip package index site, PyPI, does not yet have Windows wheels for some packages, such as SciPy.

windows下需要自己下载代码编译

Windows does not have any package manager analogous to that in Linux, so installing one of the scientific Python distributions mentioned above is preferred. However, if that is not an option, Christoph Gohlke provides pre-built Windows installers for many Python packages, including all of the core SciPy stack, which work extremely well.

后面再研究一下这个。