Skip to content

Commit d68aa4e

Browse files
committed
Merge pull request #3399 from jenshnielsen/cherrypick-v140
Cherrypick doc changes to v1.4.x
2 parents 4ff936e + b48856b commit d68aa4e

File tree

2 files changed

+91
-103
lines changed

2 files changed

+91
-103
lines changed

INSTALL

+70-103
Original file line numberDiff line numberDiff line change
@@ -12,100 +12,44 @@ installed, and how you want to use it. To avoid wading through all
1212
the details (and potential complications) on this page, there are several
1313
convenient options.
1414

15+
Installing pre-built packages
16+
=============================
17+
1518
Most platforms : scientific Python distributions
16-
================================================
19+
------------------------------------------------
20+
21+
The first option is to use one of the pre-packaged python
22+
distributions that already provide matplotlib built-in. The
23+
Continuum.io Python distribution (`Anaconda
24+
<https://store.continuum.io/cshop/anaconda/>`_ or `miniconda
25+
<http://conda.pydata.org/miniconda.html>`_) and the Enthought
26+
distribution `(Canopy) <https://www.enthought.com/products/canopy/>`_
27+
are both excellent choices that "just work" out of the box for
28+
Windows, OSX and common Linux platforms. Both of these distributions
29+
include matplotlib and *lots* of other useful tools. Another
30+
excellent alternative for Windows users is `Python (x, y)
31+
<https://code.google.com/p/pythonxy>`_ .
1732

18-
The first option is to use one of the pre-packaged python distributions that
19-
already provide matplotlib built-in. The Continuum.io Python distribution
20-
`(Anaconda) <https://store.continuum.io/cshop/anaconda/>`_ and the Enthought
21-
distribution `(Canopy) <https://www.enthought.com/products/canopy/>`_ are both
22-
excellent choices that "just work" out of the box for Windows, OSX and common
23-
Linux platforms. Both of these distributions include matplotlib and *lots* of
24-
other useful tools. Another excellent alternative for Windows users is
25-
`Python (x, y) <https://code.google.com/p/pythonxy>`_ .
2633

2734
Linux : using your package manager
28-
==================================
35+
----------------------------------
2936

3037
If you are on Linux, you might prefer to use your package manager. matplotlib
3138
is packaged for almost every major Linux distribution.
3239

3340
* Debian / Ubuntu : ``sudo apt-get install python-matplotlib``
3441
* Fedora / Redhat : ``sudo yum install python-matplotlib``
3542

36-
Mac OSX - using pip
37-
===================
43+
Mac OSX : using pip
44+
-------------------
3845

3946
If you are on Mac OSX you can probably install matplotlib binaries using the
4047
standard Python installation program `pip <https://pypi.python.org/pip>`_.
41-
See :ref:`installing-osx-binaries`.
42-
43-
Manually installing pre-built packages
44-
======================================
45-
46-
General instructions
47-
--------------------
48-
49-
For some people, the prepackaged pythons discussed above are not an
50-
option. That's OK, it's usually pretty easy to get a custom install
51-
working. You will first need to find out if you have python installed
52-
on your machine, and if not, install it. The official python builds
53-
are available for download `here <http://www.python.org/download>`_,
54-
but OS X users please read :ref:`which-python-for-osx`.
55-
56-
Once you have Python up and running, you will need to install `numpy
57-
<http://www.numpy.org/>`_. numpy provides high-performance array data
58-
structures and mathematical functions, and is a requirement for
59-
matplotlib. You can test your progress::
60-
61-
>>> import numpy
62-
>>> print numpy.__version__
63-
64-
matplotlib requires numpy version |minimum_numpy_version| or later.
65-
Although it is not a requirement to use matplotlib, we strongly
66-
encourage you to install `ipython <http://ipython.org>`_, which is an
67-
interactive shell for python that is matplotlib-aware.
68-
69-
Next, we need to get matplotlib installed. We provide prebuilt
70-
binaries for OS X and Windows on the matplotlib `download
71-
<http://matplotlib.org/downloads.html>`_. Click on
72-
the latest release of the "matplotlib" package, choose your python
73-
version (2.6, 2.7, 3.3, or 3.4) and your platform (macosx or win32). If you
74-
have any problems, please check the :ref:`installing-faq`, search
75-
using Google, and/or post a question the `mailing list
76-
<http://sourceforge.net/project/showfiles.php?group_id=80706>`_.
77-
78-
If you are on Debian/Ubuntu linux, it suffices to do::
48+
See :ref:`install_osx_binaries`.
7949

80-
> sudo apt-get install python-matplotlib
8150

82-
Instructions for installing our OSX binaries are found in the FAQ
83-
:ref:`install_osx_binaries`.
84-
85-
86-
Once you have ipython, numpy and matplotlib installed, you can use
87-
ipython's "pylab" mode to have a MATLAB-like environment that automatically
88-
handles most of the configuration details for you, so you can get up
89-
and running quickly::
90-
91-
johnh@flag:~> ipython -pylab
92-
Python 2.4.5 (#4, Apr 12 2008, 09:09:16)
93-
IPython 0.9.0 -- An enhanced Interactive Python.
94-
95-
Welcome to pylab, a matplotlib-based Python environment.
96-
For more information, type 'help(pylab)'.
97-
98-
In [1]: x = randn(10000)
99-
100-
In [2]: hist(x, 100)
101-
102-
Note that when testing matplotlib installations from the interactive
103-
python console, there are some issues relating to user interface
104-
toolkits and interactive settings that are discussed in
105-
:ref:`mpl-shell`.
106-
107-
Installing on Windows
108-
---------------------
51+
Windows
52+
-------
10953

11054
If you don't already have Python installed, we recommend using
11155
one of the `scipy-stack compatible Python distributions
@@ -175,6 +119,8 @@ sys.prefix\Lib\site-packages\mpl_toolkits respectively, and install
175119
Pillow, MiKTeX, GhostScript, ffmpeg, avconv, mencoder, ImageMagick, and
176120
`Inkscape <http://inkscape.org/>`_.
177121

122+
123+
178124
.. _install_from_source:
179125

180126
Installing from source
@@ -213,31 +159,19 @@ e.g., if the header to some required library is in
213159
.. _install_requirements:
214160

215161
Build requirements
216-
==================
162+
------------------
217163

218164
These are external packages which you will need to install before
219165
installing matplotlib. If you are building on OSX, see
220166
:ref:`build_osx`. If you are installing dependencies with a package
221167
manager on Linux, you may need to install the development packages
222168
(look for a "-dev" postfix) in addition to the libraries themselves.
223169

224-
.. note::
225-
226-
If you are on Debian/Ubuntu, you can get all the dependencies
227-
required to build matplotlib with::
228-
229-
sudo apt-get build-dep python-matplotlib
230-
231-
If you are on Fedora/RedHat, you can get all the dependencies
232-
required to build matplotlib by first installing ``yum-builddep``
233-
and then running::
234-
235-
su -c "yum-builddep python-matplotlib"
236170

237-
This does not build matplotlib, but it does get the install the
238-
build dependencies, which will make building from source easier.
171+
Required Dependencies
172+
^^^^^^^^^^^^^^^^^^^^^
239173

240-
:term:`python` 2.6, 2.7, 3.1 or 3.2
174+
:term:`python` 2.6, 2.7, 3.3 or 3.4
241175
`Download python <http://www.python.org/download/>`_.
242176

243177
:term:`numpy` |minimum_numpy_version| (or later)
@@ -267,7 +201,8 @@ libpng 1.2 (or later)
267201
build support into the matplotlib single-click installer
268202

269203

270-
**Optional GUI frameworks**
204+
Optional GUI framework
205+
^^^^^^^^^^^^^^^^^^^^^^
271206

272207
These are optional packages which you may want to install to use
273208
matplotlib with a user interface toolkit. See
@@ -288,29 +223,29 @@ backends and the capabilities they provide.
288223
The python wrappers for the wx widgets library for use with the
289224
WX or WXAgg backend
290225

291-
**Optional external programs**
292-
226+
Optional external programs
227+
^^^^^^^^^^^^^^^^^^^^^^^^^^
293228
ffmpeg/avconv or mencoder
294229
Required for the animation module to be save out put to movie
295230
formats.
296231

297232
ImageMagick
298233
Required for the animation module to be able to save to animated gif.
299234

300-
**Optional dependencies**
235+
Optional dependencies
236+
^^^^^^^^^^^^^^^^^^^^^
301237

302238
`Pillow http://python-imaging.github.io/`__
303239
If Pillow is installed, matplotlib can read and write a larger
304240
selection of image file formats.
305241

306242

307243
:term:`freetype` 1.4 (or later)
308-
library for reading true type font files. If you are a windows
309-
user, you can ignore this since we build support into the
310-
matplotlib single click installer.
244+
library for reading true type font files.
311245

312-
**Required libraries that ship with matplotlib**
313246

247+
Required libraries that ship with matplotlib
248+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
314249
:term:`agg` 2.4
315250
The antigrain C++ rendering engine. matplotlib links against the
316251
agg template source statically, so it will not affect anything on
@@ -326,14 +261,46 @@ ImageMagick
326261
`ttconv`
327262
truetype font utility
328263

264+
.. _build_linux:
265+
266+
Building on Linux
267+
-----------------
268+
269+
It is easiest to use your system package manager to install the dependencies.
270+
271+
If you are on Debian/Ubuntu, you can get all the dependencies
272+
required to build matplotlib with::
273+
274+
sudo apt-get build-dep python-matplotlib
275+
276+
If you are on Fedora/RedHat, you can get all the dependencies required
277+
to build matplotlib by first installing ``yum-builddep`` and then
278+
running::
279+
280+
su -c "yum-builddep python-matplotlib"
281+
282+
This does not build matplotlib, but it does get the install the
283+
build dependencies, which will make building from source easier.
284+
285+
329286
.. _build_osx:
330287

331288
Building on OSX
332-
===============
289+
---------------
333290

334291
The build situation on OSX is complicated by the various places one
335292
can get the libpng and freetype requirements (darwinports, fink,
336293
/usr/X11R6) and the different architectures (e.g., x86, ppc, universal) and
337294
the different OSX version (e.g., 10.4 and 10.5). We recommend that you build
338295
the way we do for the OSX release: get the source from the tarball or the
339296
git repository and follow the instruction in :file:`README.osx`.
297+
298+
.. _build_osx:
299+
300+
Building on Windows
301+
-------------------
302+
303+
Building for source on windows can be difficult. Please see
304+
`matplotlib-windbuild
305+
<https://github.com/jbmohler/matplotlib-winbuild>`_ for detailed
306+
instructions, dependency source blobs, and helper scripts.

doc/faq/usage_faq.rst

+21
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,27 @@ idea). When the figure is rendered, all of the artists are drawn to
114114
the **canvas**. Most Artists are tied to an Axes; such an Artist
115115
cannot be shared by multiple Axes, or moved from one to another.
116116

117+
.. _input_types:
118+
119+
Types of inputs to plotting functions
120+
=====================================
121+
122+
All of plotting functions expect `np.array` or `np.ma.masked_array` as
123+
input. Classes that are 'array-like' such as `pandas` data objects
124+
and `np.matrix` may or may not work as intended. It is best to
125+
convert these to `np.array` objects prior to plotting.
126+
127+
For example, to covert a `pandas.DataFrame` ::
128+
129+
a = pandas.DataFrame(np.random.rand(4,5), columns = list('abcde'))
130+
a_asndarray = a.values
131+
132+
and to covert a `np.matrix` ::
133+
134+
b = np.matrix([[1,2],[3,4]])
135+
b_asarray = np.asarray(b)
136+
137+
117138

118139
.. _pylab:
119140

0 commit comments

Comments
 (0)