Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 846758b

Browse files
committed
Merge pull request #6557 from jenshnielsen/2xmaster
Merge 2.x to master
2 parents cb01731 + 9cabdc6 commit 846758b

File tree

16 files changed

+268
-288
lines changed

16 files changed

+268
-288
lines changed

INSTALL

Lines changed: 35 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
.. The source of this document is INSTALL. During the doc build process,
22
.. this file is copied over to doc/users/installing.rst.
33
.. Therefore, you must edit INSTALL, *not* doc/users/installing.rst!
4+
.. _pip: https://pypi.python.org/pypi/pip/
45

56
**********
67
Installing
@@ -21,14 +22,12 @@ Most platforms : scientific Python distributions
2122
The first option is to use one of the pre-packaged python
2223
distributions that already provide matplotlib built-in. The
2324
Continuum.io Python distribution (`Anaconda
24-
<https://store.continuum.io/cshop/anaconda/>`_ or `miniconda
25+
<https://www.continuum.io/downloads/>`_ or `miniconda
2526
<http://conda.pydata.org/miniconda.html>`_) and the Enthought
2627
distribution `(Canopy) <https://www.enthought.com/products/canopy/>`_
2728
are both excellent choices that "just work" out of the box for
2829
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>`_ .
30+
include matplotlib and *lots* of other useful tools.
3231

3332

3433
Linux : using your package manager
@@ -44,43 +43,36 @@ Mac OSX : using pip
4443
-------------------
4544

4645
If you are on Mac OSX you can probably install matplotlib binaries using the
47-
standard Python installation program `pip <https://pypi.python.org/pypi/pip>`_.
46+
standard Python installation program pip_.
4847
See :ref:`install_osx_binaries`.
4948

49+
.. _installing_windows:
5050

5151
Windows
5252
-------
5353

5454
If you don't already have Python installed, we recommend using
5555
one of the `scipy-stack compatible Python distributions
5656
<http://www.scipy.org/install.html>`_ such as WinPython, Python(x,y),
57-
Enthought Canopy, or Continuum Anaconda, which have matplotlib and
58-
many of its dependencies, plus other useful packages, preinstalled.
59-
60-
For `standard Python <http://www.python.org/download/>`_ installations
61-
you will also need to install compatible versions of
62-
`setuptools <https://pypi.python.org/pypi/setuptools/>`_,
63-
`numpy <https://pypi.python.org/pypi/numpy/>`_,
64-
`python-dateutil <https://pypi.python.org/pypi/python-dateutil/>`_,
65-
`pytz <https://pypi.python.org/pypi/pytz>`_,
66-
`pyparsing <https://pypi.python.org/pypi/pyparsing/>`_, and
67-
`cycler <https://pypi.python.org/pypi/Cycler>`_
68-
in addition to
69-
`matplotlib <http://pypi.python.org/pypi/matplotlib/>`_.
70-
71-
For Python 3.5 the `Visual C++ Redistributable for Visual Studio 2015
72-
<http://www.microsoft.com/en-us/download/details.aspx?id=48145>`_
73-
needs to be installed.
74-
In case Python 2.7 to 3.4 are not installed for all users (not the default),
57+
Enthought Canopy, or Continuum Anaconda, which have matplotlib and many
58+
of its dependencies, plus other useful packages, preinstalled.
59+
60+
For `standard Python <https://www.python.org/download/>`_ installations,
61+
install matplotlib using pip_::
62+
63+
python -m pip install -U pip setuptools
64+
python -m pip install matplotlib
65+
66+
In case Python 2.7 or 3.4 are not installed for all users,
7567
the Microsoft Visual C++ 2008 (
7668
`64 bit <http://www.microsoft.com/download/en/details.aspx?id=15336>`__
7769
or
7870
`32 bit <http://www.microsoft.com/download/en/details.aspx?id=29>`__
79-
for Python 2.7 to 3.2) or Microsoft Visual C++ 2010 (
71+
for Python 2.7) or Microsoft Visual C++ 2010 (
8072
`64 bit <http://www.microsoft.com/en-us/download/details.aspx?id=14632>`__
8173
or
8274
`32 bit <http://www.microsoft.com/en-us/download/details.aspx?id=5555>`__
83-
for Python 3.3 and 3.4) redistributable packages need to be installed.
75+
for Python 3.4) redistributable packages need to be installed.
8476

8577
Matplotlib depends on `Pillow <https://pypi.python.org/pypi/Pillow>`_
8678
for reading and saving JPEG, BMP, and TIFF image files.
@@ -105,22 +97,23 @@ For other backends you may need to install
10597
or GhostScript.
10698

10799
TkAgg is probably the best backend for interactive use from the
108-
standard Python shell or IPython. It is enabled as the default backend
100+
standard Python shell or IPython. It is enabled as the default backend
109101
for the official binaries. GTK3 is not supported on Windows.
110102

111-
The Windows installers (:file:`*.exe`) and wheels (:file:`*.whl`) on
112-
the `PyPI download page <http://pypi.python.org/pypi/matplotlib/>`_ do
113-
not contain test data or example code. If you want to try the many
114-
demos that come in the matplotlib source distribution, download the
115-
:file:`*.tar.gz` file and look in the :file:`examples` subdirectory.
116-
To run the test suite, copy the :file:`lib\matplotlib\tests` and
117-
:file:`lib\mpl_toolkits\tests` directories from the source
118-
distribution to :file:`sys.prefix\Lib\site-packages\matplotlib` and
119-
:file:`sys.prefix\Lib\site-packages\mpl_toolkits` respectively, and
103+
The Windows wheels (:file:`*.whl`) on the `PyPI download page
104+
<https://pypi.python.org/pypi/matplotlib/>`_ do not contain test data
105+
or example code.
106+
If you want to try the many demos that come in the matplotlib source
107+
distribution, download the :file:`*.tar.gz` file and look in the
108+
:file:`examples` subdirectory.
109+
To run the test suite, copy the :file:`lib\\matplotlib\\tests` and
110+
:file:`lib\\mpl_toolkits\\tests` directories from the source
111+
distribution to :file:`sys.prefix\\Lib\\site-packages\\matplotlib` and
112+
:file:`sys.prefix\\Lib\\site-packages\\mpl_toolkits` respectively, and
120113
install `nose <https://pypi.python.org/pypi/nose>`_, `mock
121114
<https://pypi.python.org/pypi/mock>`_, Pillow, MiKTeX, GhostScript,
122115
ffmpeg, avconv, mencoder, ImageMagick, and `Inkscape
123-
<http://inkscape.org/>`_.
116+
<https://inkscape.org/>`_.
124117

125118

126119

@@ -327,17 +320,14 @@ git repository and follow the instruction in :file:`README.osx`.
327320

328321
.. _build_windows:
329322

330-
331323
Building on Windows
332324
-------------------
333325

334326
The Python shipped from http://www.python.org is compiled with Visual Studio
335-
2008 for versions before 3.3 and Visual Studio 2010 for 3.3 and later. Python
336-
extensions are recommended to be compiled with the same compiler. The .NET
337-
Framework 4.0 is required for MSBuild (you'll likely have the requisite
338-
Framework with Visual Studio). In addition to Visual Studio `CMake
339-
<http://www.cmake.org>`_ is required for building libpng.
340-
341-
Since there is no canonical Windows package manager the build methods for
342-
freetype, zlib, libpng, tcl, & tk source code are documented as a build script
327+
2008 for versions before 3.3, Visual Studio 2010 for 3.3 and 3.4, and
328+
Visual Studio 2015 for 3.5. Python extensions are recommended to be compiled
329+
with the same compiler.
330+
331+
Since there is no canonical Windows package manager, the methods for building
332+
freetype, zlib, and libpng from source code are documented as a build script
343333
at `matplotlib-winbuild <https://github.com/jbmohler/matplotlib-winbuild>`_.

doc/_static/logo2.png

21.8 KB
Loading

doc/_templates/index.html

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ <h1>Introduction</h1>
6565
You can generate plots, histograms, power spectra, bar charts,
6666
errorcharts, scatterplots, etc, with just a few lines of code.
6767
For a sampling, see the <a href="{{ pathto('users/screenshots') }}">screenshots</a>, <a href="{{ pathto('gallery') }}">thumbnail</a> gallery, and
68-
<a href="examples/index.html">examples</a> directory</p>
68+
<a href="{{ pathto('examples/index') }}">examples</a> directory</p>
6969

7070
<p>For simple plotting the <tt>pyplot</tt> interface provides a
7171
MATLAB-like interface, particularly when combined
@@ -102,9 +102,7 @@ <h1>John Hunter (1968-2012)</h1>
102102

103103
<h1>Installation</h1>
104104

105-
Visit the
106-
<a href="http://matplotlib.org/users/installing.html">matplotlib
107-
installation instructions.</a>.
105+
Visit the <a href="{{ pathto('users/installing') }}">matplotlib installation instructions</a>.
108106

109107
<h1>Documentation</h1>
110108

@@ -116,8 +114,8 @@ <h1>Documentation</h1>
116114
</script>
117115

118116
<p>Trying to learn how to do a particular kind of plot? Check out
119-
the <a href="gallery.html">gallery</a>, <a href="examples/index.html">examples</a>,
120-
or the <a href="api/pyplot_summary.html">list of plotting
117+
the <a href="{{ pathto('gallery') }}">gallery</a>, <a href="{{ pathto('examples/index') }}">examples</a>,
118+
or the <a href="{{ pathto('api/pyplot_summary') }}">list of plotting
121119
commands</a>.</p>
122120

123121
<h4>Other learning resources</h4>

doc/_templates/layout.html

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,8 +168,11 @@ <h3>{{ _('Navigation') }}</h3>
168168
</map>
169169

170170
<div style="background-color: white; text-align: left; padding: 10px 10px 15px 15px">
171-
<a href="{{ pathto('index') }}"><img src="{{
172-
pathto("_static/logo2.svg", 1) }}" width="540px" border="0" alt="matplotlib"/></a>
171+
{%- if builder in ('htmlhelp', 'devhelp', 'latex') %}
172+
<a href="{{ pathto('index') }}"><img src="{{pathto("_static/logo2.png", 1) }}" width="540px" border="0" alt="matplotlib"/></a>
173+
{%- else %}
174+
<a href="{{ pathto('index') }}"><img src="{{pathto("_static/logo2.svg", 1) }}" width="540px" border="0" alt="matplotlib"/></a>
175+
{%- endif %}
173176
</div>
174177

175178
{% endblock %}

doc/faq/installing_faq.rst

Lines changed: 1 addition & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -52,31 +52,6 @@ matplotlib was originally installed on your system. Follow the steps
5252
below that goes with your original installation method to cleanly
5353
remove matplotlib from your system.
5454

55-
Easy Install
56-
------------
57-
58-
1. Delete the caches from your :ref:`.matplotlib configuration directory
59-
<locating-matplotlib-config-dir>`.
60-
61-
2. Run::
62-
63-
easy_install -m matplotlib
64-
65-
66-
3. Delete any .egg files or directories from your :ref:`installation
67-
directory <locating-matplotlib-install>`.
68-
69-
70-
71-
Windows installer
72-
-----------------
73-
74-
1. Delete the caches from your :ref:`.matplotlib configuration directory
75-
<locating-matplotlib-config-dir>`.
76-
77-
2. Use :menuselection:`Start --> Control Panel` to start the :program:`Add and
78-
Remove Software` utility.
79-
8055
Source install
8156
--------------
8257

@@ -374,24 +349,4 @@ know: see :ref:`reporting-problems`.
374349
Windows Notes
375350
=============
376351

377-
We recommend you use one of the excellent python collections which include
378-
Python itself and a wide range of libraries including matplotlib:
379-
380-
- Anaconda_ from `Continuum Analytics`_
381-
- Canopy_ from Enthought_
382-
- `Python (x, y) <https://code.google.com/p/pythonxy>`_
383-
384-
Python (X, Y) is Windows-only, whereas Anaconda and Canopy are cross-platform.
385-
386-
.. _windows-installers:
387-
388-
Standalone binary installers for Windows
389-
----------------------------------------
390-
391-
If you have already installed Python and numpy, you can use one of the
392-
matplotlib binary installers for windows -- you can get these from the
393-
`the PyPI matplotlib page <http://pypi.python.org/pypi/matplotlib>`_
394-
site. Choose the files with an ``.exe`` extension that match your
395-
version of Python (e.g., ``py2.7`` if you installed Python 2.7). If
396-
you haven't already installed Python, you can get the official version
397-
from the `Python web site <http://python.org/download/>`_.
352+
See :ref:`installing_windows`.

examples/color/named_colors.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
ncols = 4
2828
nrows = int(np.ceil(1. * n / ncols))
2929

30-
fig, ax = plt.subplots()
30+
fig, ax = plt.subplots(figsize=(8, 5))
3131

3232
X, Y = fig.get_dpi() * fig.get_size_inches()
3333

@@ -49,10 +49,6 @@
4949
horizontalalignment='left',
5050
verticalalignment='center')
5151

52-
# Add extra black line a little bit thicker to make
53-
# clear colors more visible.
54-
ax.hlines(
55-
y, xi_line, xf_line, color='black', linewidth=(h * 0.7))
5652
ax.hlines(
5753
y + h * 0.1, xi_line, xf_line, color=colors[name], linewidth=(h * 0.6))
5854

examples/pylab_examples/csd_demo.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,10 @@
44
import numpy as np
55
import matplotlib.pyplot as plt
66

7+
8+
fig, (ax1, ax2) = plt.subplots(2, 1)
79
# make a little extra space between the subplots
8-
plt.subplots_adjust(wspace=0.5)
10+
fig.subplots_adjust(hspace=0.5)
911

1012
dt = 0.01
1113
t = np.arange(0, 30, dt)
@@ -20,14 +22,12 @@
2022
s1 = 0.01*np.sin(2*np.pi*10*t) + cnse1
2123
s2 = 0.01*np.sin(2*np.pi*10*t) + cnse2
2224

23-
plt.subplot(211)
24-
plt.plot(t, s1, t, s2)
25-
plt.xlim(0, 5)
26-
plt.xlabel('time')
27-
plt.ylabel('s1 and s2')
28-
plt.grid(True)
25+
ax1.plot(t, s1, t, s2)
26+
ax1.set_xlim(0, 5)
27+
ax1.set_xlabel('time')
28+
ax1.set_ylabel('s1 and s2')
29+
ax1.grid(True)
2930

30-
plt.subplot(212)
31-
cxy, f = plt.csd(s1, s2, 256, 1./dt)
32-
plt.ylabel('CSD (db)')
31+
cxy, f = ax2.csd(s1, s2, 256, 1./dt)
32+
ax2.set_ylabel('CSD (db)')
3333
plt.show()

examples/showcase/bachelors_degrees_by_gender.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,12 @@
2727
ax.get_xaxis().tick_bottom()
2828
ax.get_yaxis().tick_left()
2929

30+
fig.subplots_adjust(left=.06, right=.75, bottom=.02, top=.94)
3031
# Limit the range of the plot to only where the data is.
3132
# Avoid unnecessary whitespace.
32-
plt.xlim(1968.5, 2011.1)
33-
plt.ylim(-0.25, 90)
33+
ax.set_xlim(1968.5, 2011.1)
34+
ax.set_ylim(-0.25, 90)
35+
ax.get_xaxis().get_major_formatter().set_useOffset(False)
3436

3537
# Make sure your axis ticks are large enough to be easily read.
3638
# You don't want your viewers squinting to read your plot.
@@ -91,10 +93,10 @@
9193

9294
# Note that if the title is descriptive enough, it is unnecessary to include
9395
# axis labels; they are self-evident, in this plot's case.
94-
plt.title('Percentage of Bachelor\'s degrees conferred to women in '
95-
'the U.S.A. by major (1970-2011)\n', fontsize=18, ha='center')
96+
fig.suptitle('Percentage of Bachelor\'s degrees conferred to women in '
97+
'the U.S.A. by major (1970-2011)\n', fontsize=18, ha='center')
9698

9799
# Finally, save the figure as a PNG.
98100
# You can also save it as a PDF, JPEG, etc.
99101
# Just change the file extension in this call.
100-
plt.savefig('percent-bachelors-degrees-women-usa.png', bbox_inches='tight')
102+
# plt.savefig('percent-bachelors-degrees-women-usa.png', bbox_inches='tight')

lib/matplotlib/axes/_axes.py

Lines changed: 1 addition & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -635,63 +635,13 @@ def text(self, x, y, s, fontdict=None,
635635

636636
@docstring.dedent_interpd
637637
def annotate(self, *args, **kwargs):
638-
"""
639-
Create an annotation: a piece of text referring to a data
640-
point.
641-
642-
Parameters
643-
----------
644-
s : string
645-
label
646-
647-
xy : (x, y)
648-
position of element to annotate. See *xycoords* to control what
649-
coordinate system this value is interpretated in.
650-
651-
xytext : (x, y) , optional, default: None
652-
position of the label `s`. See *textcoords* to control what
653-
coordinate system this value is interpreted in.
654-
655-
xycoords : string, optional, default: "data"
656-
string that indicates what type of coordinates `xy` is. Examples:
657-
"figure points", "figure pixels", "figure fraction", "axes
658-
points", .... See `matplotlib.text.Annotation` for more details.
659-
660-
textcoords : string, optional, default: None
661-
string that indicates what type of coordinates `text` is. Examples:
662-
"figure points", "figure pixels", "figure fraction", "axes
663-
points", .... See `matplotlib.text.Annotation` for more details.
664-
665-
arrowprops : `matplotlib.lines.Line2D` properties, optional
666-
Dictionary of line properties for the arrow that connects
667-
the annotation to the point. If the dictionnary has a key
668-
`arrowstyle`, a `~matplotlib.patches.FancyArrowPatch`
669-
instance is created and drawn. See
670-
`matplotlib.text.Annotation` for more details on valid
671-
options. Default is None.
672-
673-
Returns
674-
-------
675-
a : `~matplotlib.text.Annotation`
676-
677-
678-
Notes
679-
-----
680-
681-
%(Annotation)s
682-
683-
Examples
684-
--------
685-
686-
.. plot:: mpl_examples/pylab_examples/annotation_demo2.py
687-
"""
688638
a = mtext.Annotation(*args, **kwargs)
689639
a.set_transform(mtransforms.IdentityTransform())
690640
if 'clip_on' in kwargs:
691641
a.set_clip_path(self.patch)
692642
self._add_text(a)
693643
return a
694-
644+
annotate.__doc__ = mtext.Annotation.__init__.__doc__
695645
#### Lines and spans
696646

697647
@docstring.dedent_interpd

0 commit comments

Comments
 (0)