Skip to content

Commit cc48afd

Browse files
authored
Merge branch 'master' into remove-deprecated21
2 parents 1279b84 + ebc3aa0 commit cc48afd

File tree

99 files changed

+1862
-1576
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

99 files changed

+1862
-1576
lines changed

.appveyor.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ install:
5959
#
6060
- conda create -q -n test-environment python=%PYTHON_VERSION%
6161
msinttypes freetype=2.6 "libpng>=1.6.21,<1.7" zlib=1.2 tk=8.5
62-
pip setuptools numpy mock pandas sphinx tornado
62+
pip setuptools numpy pandas sphinx tornado
6363
- activate test-environment
6464
- echo %PYTHON_VERSION% %TARGET_ARCH%
6565
# pytest-cov>=2.3.1 due to https://github.com/pytest-dev/pytest-cov/issues/124

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ result_images
8080

8181
# Nose/Pytest generated files #
8282
###############################
83+
.pytest_cache/
8384
.cache/
8485
.coverage
8586
.coverage.*

.travis.yml

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ addons:
3737
- texlive-latex-extra
3838
- texlive-latex-recommended
3939
- texlive-xetex
40+
- texlive-luatex
4041

4142
env:
4243
global:
@@ -47,7 +48,6 @@ env:
4748
- secure: "dfjNqGKzQG5bu3FnDNwLG8H/C4QoieFo4PfFmZPdM2RY7WIzukwKFNT6kiDfOrpwt+2bR7FhzjOGlDECGtlGOtYPN8XuXGjhcP4a4IfakdbDfF+D3NPIpf5VlE6776k0VpvcZBTMYJKNFIMc7QPkOwjvNJ2aXyfe3hBuGlKJzQU="
4849
- CYCLER=cycler
4950
- DATEUTIL=python-dateutil
50-
- MOCK=
5151
- NOSE=
5252
- NUMPY=numpy
5353
- PANDAS=
@@ -70,7 +70,6 @@ matrix:
7070
env:
7171
- CYCLER=cycler==0.10
7272
- DATEUTIL=python-dateutil==2.1
73-
- MOCK=mock
7473
- NOSE=nose
7574
- NUMPY=numpy==1.10.0
7675
- PANDAS='pandas<0.21.0'
@@ -86,7 +85,6 @@ matrix:
8685
env: PRE=--pre
8786
- os: osx
8887
language: generic # https://github.com/travis-ci/travis-ci/issues/2312
89-
env: MOCK=mock
9088
only: master
9189
cache:
9290
# As for now travis caches only "$HOME/.cache/pip"
@@ -109,9 +107,8 @@ before_install:
109107
export PATH=/usr/lib/ccache:$PATH
110108
else
111109
ci/travis/silence brew update
112-
brew install python3 ffmpeg imagemagick mplayer ccache
113-
# make 'python' mean 'python3'
114-
ln -sf /usr/local/bin/python3 /usr/local/bin/python
110+
brew upgrade python
111+
brew install ffmpeg imagemagick mplayer ccache
115112
hash -r
116113
which python
117114
python --version
@@ -122,21 +119,18 @@ before_install:
122119
fi
123120
124121
install:
125-
# Upgrade pip and setuptools. Mock has issues with the default version of
126-
# setuptools
127122
- |
128-
# Setup environment
123+
# Setup environment.
129124
ccache -s
130125
git describe
131-
# Upgrade pip and setuptools and wheel to get as clean an install as possible
126+
# Upgrade pip and setuptools and wheel to get as clean an install as possible.
132127
python -mpip install --upgrade pip setuptools wheel
133128
- |
134-
# Install dependencies from PyPI
129+
# Install dependencies from PyPI.
135130
python -mpip install --upgrade $PRE \
136131
codecov \
137132
coverage \
138133
$CYCLER \
139-
$MOCK \
140134
$NOSE \
141135
$NUMPY \
142136
$PANDAS \

INSTALL.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,9 @@ To run the test suite:
5454
* extract the :file:`lib\\matplotlib\\tests` or
5555
:file:`lib\\mpl_toolkits\\tests` directories from the source distribution;
5656
* install test dependencies: `pytest <https://pypi.python.org/pypi/pytest>`_,
57-
`mock <https://pypi.python.org/pypi/mock>`_, Pillow, MiKTeX, GhostScript,
58-
ffmpeg, avconv, ImageMagick, and `Inkscape <https://inkscape.org/>`_;
59-
* run ``py.test path\to\tests\directory``.
57+
Pillow, MiKTeX, GhostScript, ffmpeg, avconv, ImageMagick, and `Inkscape
58+
<https://inkscape.org/>`_;
59+
* run ``pytest path\to\tests\directory``.
6060

6161

6262
Third-party distributions of Matplotlib

README.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,16 +52,16 @@ Testing
5252

5353
After installation, you can launch the test suite::
5454

55-
py.test
55+
pytest
5656

5757
Or from the Python interpreter::
5858

5959
import matplotlib
6060
matplotlib.test()
6161

62-
Consider reading http://matplotlib.org/devel/coding_guide.html#testing for
63-
more information. Note that the test suite requires pytest and, on Python 2.7,
64-
mock. Please install with pip or your package manager of choice.
62+
Consider reading http://matplotlib.org/devel/coding_guide.html#testing for more
63+
information. Note that the test suite requires pytest. Please install with pip
64+
or your package manager of choice.
6565

6666
Contact
6767
=======

doc-requirements.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ sphinx>=1.3,!=1.5.0,!=1.6.4
1010
colorspacious
1111
ipython
1212
ipywidgets
13-
mock
1413
numpydoc>=0.4
1514
pillow
1615
sphinx-gallery>=0.1.12

doc/conf.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,6 @@ def _check_deps():
5858
"numpydoc": 'numpydoc',
5959
"PIL.Image": 'pillow',
6060
"sphinx_gallery": 'sphinx_gallery'}
61-
if sys.version_info < (3, 3):
62-
names["mock"] = 'mock'
6361
missing = []
6462
for name in names:
6563
try:

doc/devel/contributing.rst

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -142,18 +142,17 @@ Additionally you will need to copy :file:`setup.cfg.template` to
142142
In either case you can then run the tests to check your work
143143
environment is set up properly::
144144

145-
python tests.py
145+
pytest
146146

147147
.. _pytest: http://doc.pytest.org/en/latest/
148148
.. _pep8: https://pep8.readthedocs.io/en/latest/
149-
.. _mock: https://docs.python.org/dev/library/unittest.mock.html
150149
.. _Ghostscript: https://www.ghostscript.com/
151150
.. _Inkscape: https://inkscape.org>
152151

153152
.. note::
154153

155154
**Additional dependencies for testing**: pytest_ (version 3.1 or later),
156-
mock_ (if Python 2), Ghostscript_, Inkscape_
155+
Ghostscript_, Inkscape_
157156

158157
.. seealso::
159158

doc/devel/documenting_mpl.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ requirements that are needed to build the documentation. They are listed in
4545
* Sphinx>=1.3, !=1.5.0, !=1.6.4
4646
* colorspacious
4747
* IPython
48-
* mock
4948
* numpydoc>=0.4
5049
* Pillow
5150
* sphinx-gallery>=0.1.12

doc/devel/testing.rst

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ Matplotlib's testing infrastructure depends on pytest_. The tests are in
99
infrastructure are in :mod:`matplotlib.testing`.
1010

1111
.. _pytest: http://doc.pytest.org/en/latest/
12-
.. _mock: https://docs.python.org/3/library/unittest.mock.html
1312
.. _Ghostscript: https://www.ghostscript.com/
1413
.. _Inkscape: https://inkscape.org
1514
.. _pytest-cov: https://pytest-cov.readthedocs.io/en/latest/
@@ -27,7 +26,6 @@ local FreeType build
2726
The following software is required to run the tests:
2827

2928
- pytest_ (>=3.1)
30-
- mock_, when running Python 2
3129
- Ghostscript_ (to render PDF files)
3230
- Inkscape_ (to render SVG files)
3331

@@ -44,7 +42,7 @@ Running the tests
4442

4543
Running the tests is simple. Make sure you have pytest installed and run::
4644

47-
py.test
45+
pytest
4846

4947
or::
5048

@@ -74,22 +72,22 @@ To run a single test from the command line, you can provide a file path,
7472
optionally followed by the function separated by two colons, e.g., (tests do
7573
not need to be installed, but Matplotlib should be)::
7674

77-
py.test lib/matplotlib/tests/test_simplification.py::test_clipping
75+
pytest lib/matplotlib/tests/test_simplification.py::test_clipping
7876

7977
or, if tests are installed, a dot-separated path to the module, optionally
8078
followed by the function separated by two colons, such as::
8179

82-
py.test --pyargs matplotlib.tests.test_simplification::test_clipping
80+
pytest --pyargs matplotlib.tests.test_simplification::test_clipping
8381

8482
If you want to run the full test suite, but want to save wall time try
8583
running the tests in parallel::
8684

87-
py.test --verbose -n 5
85+
pytest --verbose -n 5
8886

8987
Depending on your version of Python and pytest-xdist, you may need to set
9088
``PYTHONHASHSEED`` to a fixed value when running in parallel::
9189

92-
PYTHONHASHSEED=0 py.test --verbose -n 5
90+
PYTHONHASHSEED=0 pytest --verbose -n 5
9391

9492
An alternative implementation that does not look at command line arguments
9593
and works from within Python is to run the tests from the Matplotlib library

doc/faq/howto_faq.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,10 @@ Finally, the multipage pdf object has to be closed::
136136

137137
pp.close()
138138

139+
The same can be done using the pgf backend::
140+
141+
from matplotlib.backends.backend_pgf import PdfPages
142+
139143

140144
.. _howto-subplots-adjust:
141145

doc/sphinxext/mock_gui_toolkits.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
import sys
2-
3-
try:
4-
from unittest.mock import MagicMock
5-
except ImportError:
6-
from mock import MagicMock
2+
from unittest.mock import MagicMock
73

84

95
class MyCairoCffi(MagicMock):

doc/thirdpartypackages/index.rst

Lines changed: 25 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -38,16 +38,6 @@ data processing tools. An example plot from the `Cartopy gallery
3838
Declarative libraries
3939
*********************
4040

41-
plotnine
42-
========
43-
44-
`plotnine <https://plotnine.readthedocs.io/en/stable/>`_ implements a grammar
45-
of graphics, similar to R's `ggplot2 <http://ggplot2.org/>`_. The grammar allows
46-
users to compose plots by explicitly mapping data to the visual objects that
47-
make up the plot.
48-
49-
.. image:: /_static/plotnine.png
50-
5141
ggplot
5242
======
5343
`ggplot <https://github.com/yhat/ggplot>`_ is a port of the R ggplot2 package
@@ -68,6 +58,16 @@ widgets for parameter exploration.
6858
.. image:: /_static/holoviews.png
6959
:height: 354px
7060

61+
plotnine
62+
========
63+
64+
`plotnine <https://plotnine.readthedocs.io/en/stable/>`_ implements a grammar
65+
of graphics, similar to R's `ggplot2 <http://ggplot2.org/>`_. The grammar allows
66+
users to compose plots by explicitly mapping data to the visual objects that
67+
make up the plot.
68+
69+
.. image:: /_static/plotnine.png
70+
7171
Specialty plots
7272
***************
7373

@@ -170,15 +170,6 @@ annotation boxes) for Matplotlib.
170170
Miscellaneous
171171
*************
172172

173-
mpl-template
174-
============
175-
`mpl-template <https://austinorr.github.io/mpl-template/index.html>`_ provides
176-
a customizable way to add engineering figure elements such as a title block,
177-
border, and logo.
178-
179-
.. image:: /_static/mpl_template_example.png
180-
:height: 330px
181-
182173
adjustText
183174
==========
184175
`adjustText <https://github.com/Phlya/adjustText>`_ is a small library for
@@ -194,3 +185,18 @@ external Matplotlib backend using the iTerm2 nightly build inline image display
194185
feature.
195186

196187
.. image:: /_static/matplotlib_iterm2_demo.png
188+
189+
mplcairo
190+
========
191+
`mplcairo <https://github.com/anntzer/mplcairo>`_ is a cairo backend for
192+
Matplotlib, with faster and more accurate marker drawing, support for a wider
193+
selection of font formats and complex text layout, and various other features.
194+
195+
mpl-template
196+
============
197+
`mpl-template <https://austinorr.github.io/mpl-template/index.html>`_ provides
198+
a customizable way to add engineering figure elements such as a title block,
199+
border, and logo.
200+
201+
.. image:: /_static/mpl_template_example.png
202+
:height: 330px

doc/users/event_handling.rst

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
Event handling and picking
55
**************************
66

7-
matplotlib works with a number of user interface toolkits (wxpython,
7+
Matplotlib works with a number of user interface toolkits (wxpython,
88
tkinter, qt4, gtk, and macosx) and in order to support features like
99
interactive panning and zooming of figures, it is helpful to the
1010
developers to have an API for interacting with the figure via key
@@ -47,14 +47,16 @@ disconnect the callback, just call::
4747
fig.canvas.mpl_disconnect(cid)
4848

4949
.. note::
50-
The canvas retains only weak references to the callbacks. Therefore
51-
if a callback is a method of a class instance, you need to retain
52-
a reference to that instance. Otherwise the instance will be
53-
garbage-collected and the callback will vanish.
50+
The canvas retains only weak references to instance methods used as
51+
callbacks. Therefore, you need to retain a reference to instances owning
52+
such methods. Otherwise the instance will be garbage-collected and the
53+
callback will vanish.
54+
55+
This does not affect free functions used as callbacks.
5456

5557

5658
Here are the events that you can connect to, the class instances that
57-
are sent back to you when the event occurs, and the event descriptions
59+
are sent back to you when the event occurs, and the event descriptions:
5860

5961

6062
======================= =============================================================================================
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
Multipage PDF support for pgf backend
2+
-------------------------------------
3+
4+
The pgf backend now also supports multipage PDF files.
5+
6+
.. code-block:: python
7+
8+
from matplotlib.backends.backend_pgf import PdfPages
9+
import matplotlib.pyplot as plt
10+
11+
with PdfPages('multipage.pdf') as pdf:
12+
# page 1
13+
plt.plot([2, 1, 3])
14+
pdf.savefig()
15+
16+
# page 2
17+
plt.cla()
18+
plt.plot([3, 1, 2])
19+
pdf.savefig()

doc/users/whats_new.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@ revision, see the :ref:`github-stats`.
1414
..
1515
For a release, add a new section after this, then comment out the include
1616
and toctree below by indenting them. Uncomment them after the release.
17-
.. include:: next_whats_new/README.rst
18-
.. toctree::
19-
:glob:
20-
:maxdepth: 1
17+
.. include:: next_whats_new/README.rst
18+
.. toctree::
19+
:glob:
20+
:maxdepth: 1
2121

22-
next_whats_new/*
22+
next_whats_new/*
2323

2424

2525
New in Matplotlib 2.2

0 commit comments

Comments
 (0)