Former-commit-id:133dc97f67
[formerlya02aeb236c
] [formerly9f19e3f712
] [formerly133dc97f67
[formerlya02aeb236c
] [formerly9f19e3f712
] [formerly06a8b51d6d
[formerly9f19e3f712
[formerly 64fa9254b946eae7e61bbc3f513b7c3696c4f54f]]]] Former-commit-id:06a8b51d6d
Former-commit-id:9bb8decbcf
[formerly8e80217e59
] [formerly377dcd10b9
[formerly3360eb6c5f
]] Former-commit-id:377dcd10b9
Former-commit-id:e2ecdcfe33
141 lines
5.7 KiB
Text
Executable file
141 lines
5.7 KiB
Text
Executable file
|
|
INTRODUCTION
|
|
|
|
matplotlib requires at a minimum python 2.3, numpy, libpng and
|
|
freetype. To get the most out of matplotlib, you will want to build
|
|
some of the optional GUI and image extensions, discussed below.
|
|
Matplotlib is known to work on linux, unix, win32 and OS X
|
|
platforms.
|
|
|
|
There are two kinds of matplotlib backends: vector based and raster
|
|
based. The vector based backends, SVG, PDF and PS, produce ASCII
|
|
text output files *.svg, *.pdf and *.ps. The core raster based
|
|
renderer is the http://antigrain.com (agg) backend. This is a high
|
|
quality 2D library that supports fast antialiasing, alpha blending
|
|
and much more. If you want to produce PNGs or GUI images that
|
|
support all of matplotlib's features, you should compile matplotlib
|
|
with agg support and use one of the GUI agg backends: GTKAgg, WXAgg,
|
|
TkAgg or FLTKAgg.
|
|
|
|
COMPILING
|
|
|
|
You will need to have recent versions of freetype, libpng and zlib
|
|
installed on your system. If you are using a package manager, also
|
|
make sure the devel versions of these packages are also installed
|
|
(eg freetype-devel).
|
|
|
|
matplotlib ships with a setup.cfg.template which you can use to
|
|
customize the build process. Copy it to setup.cfg if you need to
|
|
customize something. See that files for details of the parameters
|
|
you can set.
|
|
|
|
If you want to use a GUI backend, you will need either Tkinter,
|
|
pygtk , wxPython or Qt installed on your system, from src or from a
|
|
package manager including the devel packages. You can choose which
|
|
backends to enable by setting the flags in setup.cfg, but the default
|
|
is to automatically detect your installed GUIs and build support for
|
|
them. If you later find that you did not have a GUI toolkit like
|
|
pygtk installed when you built matplotlib, but now want it, you will
|
|
need to install the toolkit and rebuild matplotlib.
|
|
|
|
If you have installed prerequisites to nonstandard places and need
|
|
to inform matplotlib where they are, edit setupext.py an add the
|
|
base dirs to the 'basedir' dictionary entry for your sys.platform.
|
|
Eg, if the header to some required library is in
|
|
/some/path/include/somheader.h, put /some/path in the basedir list
|
|
for your platform.
|
|
|
|
|
|
Once you have everything above set to your liking, just do the usual
|
|
thing
|
|
|
|
python setup.py build
|
|
python setup.py install
|
|
|
|
WINDOWS
|
|
|
|
If you don't already have python installed, you may want to consider
|
|
using the enthought edition of python, which has scipy, numpy, and
|
|
wxpython, plus a lot of other goodies, preinstalled -
|
|
http://www.enthought.com/python . With the enthought edition of
|
|
python + matplotlib installer, the following backends should work
|
|
out of the box: agg, wx, wxagg, tkagg, ps, pdf and svg.
|
|
|
|
For standard python installations, you will also need to install
|
|
either numpy, in addition to the matplotlib installer. On some
|
|
systems you will also need to download msvcp71.dll library, which
|
|
you can download from
|
|
http://www.dll-files.com/dllindex/dll-files.shtml?msvcp71 or other
|
|
sites. You will need to unzip the archive and drag the dll into
|
|
c:\windows\system32
|
|
|
|
All of the GUI backends run on windows, but TkAgg is probably the
|
|
best for interactive use from the standard python shell or ipython.
|
|
The windows installer (*.exe) on the download page contains all the
|
|
code you need to get up and running. However, there are many
|
|
examples that are not included in the windows installer. If you
|
|
want to try the many demos that come in the matplotlib src
|
|
distribution, download the zip file and look in the examples subdir.
|
|
|
|
Important: There are known conflicts with some of the backends with
|
|
some python IDEs such as pycrust, idle. If you want to
|
|
use matplotlib from an IDE, please consult
|
|
http://matplotlib.sf.net/backends.html for compatibility
|
|
information. You will have the greatest likelihood of
|
|
success if you run the examples from the command shell or
|
|
by double clicking on them, rather than from an IDE. If
|
|
you are interactively generating plots, your best bet is
|
|
TkAgg from the standard python shell or ipython.
|
|
|
|
DISTROS: (rpms, apt, fink, osx, freebsd, gentoo, etc)
|
|
|
|
RPMS
|
|
|
|
To build all the backends on a binary linux distro such as redhat,
|
|
you need to install a number of the devel libs (and whatever
|
|
dependencies they require), I suggest
|
|
|
|
matplotlib core: zlib, zlib-devel, libpng, libpng-devel,
|
|
freetype, freetype-devel, freetype-utils
|
|
|
|
gtk backend: gtk2-devel, gtk+-devel, pygtk2, glib-devel,
|
|
pygtk2-devel, gnome-libs-devel, pygtk2-libglade
|
|
|
|
tk backend: tcl, tk, tkinter
|
|
|
|
DEBIAN
|
|
|
|
matplotlib is part of debian (and ubuntu) so you shoule be able to
|
|
apt-get install it.
|
|
|
|
FREEBSD
|
|
|
|
http://www.freshports.org/math/py-matplotlib/
|
|
|
|
Gentoo
|
|
|
|
http://www.gentoo-portage.com/dev-python/matplotlib
|
|
|
|
OS X
|
|
|
|
All of the backends run on OS X. You will need to install
|
|
freetype2, libpng and zlib via fink or from src. You will also
|
|
need the base libraries for a given backend. Eg, if you want to
|
|
run TkAgg, you will need a python with Tkinter; if you want to use
|
|
WxAgg, install wxpython. See
|
|
http://matplotlib.sf.net/backends.html for a more comprehensive
|
|
discussion of the various backend requirements. Edit setup.py to
|
|
configure the backends you want to build as described above.
|
|
|
|
Note when running a GUI backend in OSX, you should launch your
|
|
programs with pythonw rather than python, or you may get
|
|
nonresponsive GUIs.
|
|
|
|
FINK
|
|
|
|
fink users should use Jeffrey Whitaker's fink distribution, which
|
|
supports the GTK, TkAgg, GTKAgg, PS, WX, WXAgg and Agg backends.
|
|
http://fink.sourceforge.net/pdb/package.php/matplotlib-py23
|
|
|
|
|
|
|