【Python】Matplotlib
【重要】 python 2.7.11
////// HomePage
http://matplotlib.org/index.html
////// install
# sudo yum install python-matplotlib
已安装:
python-matplotlib.x86_64 0:1.2.0-15.el7
作为依赖被安装:
agg.x86_64 0:2.5-18.el7
atlas.x86_64 0:3.10.1-10.el7
blas.x86_64 0:3.4.2-5.el7
lapack.x86_64 0:3.4.2-5.el7
libgfortran.x86_64 0:4.8.5-4.el7
libquadmath.x86_64 0:4.8.5-4.el7
numpy.x86_64 1:1.7.1-11.el7
python-nose.noarch 0:1.3.0-3.el7
t1lib.x86_64 0:5.1.2-14.el7
texlive-base.noarch 2:2012-38.20130427_r30134.el7
texlive-dvipng.noarch 2:svn26689.1.14-38.el7
texlive-dvipng-bin.x86_64 2:svn26509.0-38.20130427_r30134.el7
texlive-kpathsea.noarch 2:svn28792.0-38.el7
texlive-kpathsea-bin.x86_64 2:svn27347.0-38.20130427_r30134.el7
texlive-kpathsea-lib.x86_64 2:2012-38.20130427_r30134.el7
////// using
[root@wode005 18.matplotlib]# python m001.py
Traceback (most recent call last):
File "m001.py", line 1, in <module>
import matplotlib as mpl
ImportError: No module named matplotlib
////// pip
# pip install matplotlib
Collecting matplotlib
Downloading matplotlib-1.5.1.tar.gz (54.0MB)
36% |███████████▉ | 20.0MB 177kB/s eta 0:03:12
////// error
freetype: no [The C/C++ header for freetype2 (ft2build.h)
could not be found. You may need to install the
development package.]
png: no [pkg-config information for 'libpng' could not
be found.]
qhull: yes [pkg-config information for 'qhull' could not be
found. Using local copy.]
# yum install freetype-devel
# yum install libpng-devel
////// Reference
http://www.cnblogs.com/vamei/archive/2013/01/30/2879700.html
////// sample code
# a strait line: use pyplot functions
from matplotlib.pyplot import *
plot([0, 1], [0, 1]) # plot a line from (0, 0) to (1, 1)
title("a strait line")
xlabel("x value")
ylabel("y value")
savefig("m002.png")
免责声明:
① 本站未注明“稿件来源”的信息均来自网络整理。其文字、图片和音视频稿件的所属权归原作者所有。本站收集整理出于非商业性的教育和科研之目的,并不意味着本站赞同其观点或证实其内容的真实性。仅作为临时的测试数据,供内部测试之用。本站并未授权任何人以任何方式主动获取本站任何信息。
② 本站未注明“稿件来源”的临时测试数据将在测试完成后最终做删除处理。有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341