8000 Merge branch 'master' into master · matplotlib/matplotlib@4cbc667 · GitHub
[go: up one dir, main page]

Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 4cbc667

Browse files
Merge branch 'master' into master
2 parents 2ad05cf + 250c33e commit 4cbc667

File tree

98 files changed

+16764
-15243
lines changed

Some content is hidden

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

98 files changed

+16764
-15243
lines changed

.circleci/config.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,12 @@ fonts-run: &fonts-install
4747
echo "Not downloading Humor-Sans; file already exists."
4848
fi
4949
fc-cache -f -v
50+
save_cache:
51+
key: fonts-1
52+
paths:
53+
- ~/.local/share/fonts/
54+
restore_cache:
55+
key: fonts-1
5056

5157
pip-run: &pip-install
5258
# Upgrade pip and setuptools and wheel to get as clean an install as possible

.flake8

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,8 @@ per-file-ignores =
5454
matplotlib/sphinxext/mathmpl.py: E302
5555
matplotlib/sphinxext/only_directives.py: E302
5656
matplotlib/sphinxext/plot_directive.py: E261, E302, E402
57-
matplotlib/tests/test_image.py: E225, E231, E251, E302, E501
58-
matplotlib/tests/test_lines.py: E231, E261
59-
matplotlib/tests/test_mathtext.py: E261, E501
57+
matplotlib/tests/test_image.py: E231
58+
matplotlib/tests/test_mathtext.py: E501
6059
matplotlib/transforms.py: E201, E202, E203, E501
6160
matplotlib/tri/triinterpolate.py: E201, E221
6261
matplotlib/type1font.py: E731
@@ -251,6 +250,7 @@ per-file-ignores =
251250
examples/style_sheets/plot_solarizedlight2.py: E501
252251
examples/subplots_axes_and_figures/axes_margins.py: E402
253252
examples/subplots_axes_and_figures/axes_zoom_effect.py: E402
253+
examples/subplots_axes_and_figures/demo_constrained_layout.py: E402
254254
examples/subplots_axes_and_figures/demo_tight_layout.py: E402
255255
examples/subplots_axes_and_figures/two_scales.py: E402
256256
examples/tests/backend_driver_sgskip.py: E402, E501

.travis.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -129,15 +129,15 @@ install:
129129
# install was successful by trying to import the toolkit (sometimes, the
130130
# install appears to be successful but shared libraries cannot be loaded at
131131
# runtime, so an actual import is a better check).
132-
python -mpip install cairocffi pgi &&
132+
python -mpip install --upgrade cairocffi>=0.8 pgi>=0.0.11.2 &&
133133
python -c 'import pgi as gi; gi.require_version("Gtk", "3.0"); from pgi.repository import Gtk' &&
134134
echo 'pgi is available' ||
135135
echo 'pgi is not available'
136-
python -mpip install pyqt5 &&
136+
python -mpip install --upgrade pyqt5 &&
137137
python -c 'import PyQt5.QtCore' &&
138138
echo 'PyQt5 is available' ||
139139
echo 'PyQt5 is not available'
140-
python -mpip install -U \
140+
python -mpip install --upgrade \
141141
-f https://extras.wxpython.org/wxPython4/extras/linux/gtk3/ubuntu-14.04 \
142142
wxPython &&
143143
python -c 'import wx' &&

INSTALL.rst

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -149,14 +149,17 @@ Optionally, you can also install a number of packages to enable better user
149149
interface toolkits. See :ref:`what-is-a-backend` for more details on the
150150
optional Matplotlib backends and the capabilities they provide.
151151

152-
* :term:`tk` (>= 8.3, != 8.6.0 or 8.6.1): for the TkAgg backend;
152+
* :term:`tk` (>= 8.3, != 8.6.0 or 8.6.1): for the Tk-based backends;
153153
* `PyQt4 <https://pypi.python.org/pypi/PyQt4>`_ (>= 4.4) or
154-
`PySide <https://pypi.python.org/pypi/PySide>`_: for the Qt4Agg backend;
155-
* `PyQt5 <https://pypi.python.org/pypi/PyQt5>`_: for the Qt5Agg backend;
156-
* :term:`wxpython` (>= 4): for the WX or WXAgg backend;
157-
* `cairocffi <https://cairocffi.readthedocs.io/en/latest/>`_ (>=0.8) or
154+
`PySide <https://pypi.python.org/pypi/PySide>`_: for the Qt4-based backends;
155+
* `PyQt5 <https://pypi.python.org/pypi/PyQt5>`_: for the Qt5-based backends;
156+
* `PyGObject <https://pypi.org/project/PyGObject/>`_ or
157+
`pgi <https://pypi.org/project/pgi/>`_ (>= 0.0.11.2): for the GTK3-based
158+
backends;
159+
* :term:`wxpython` (>= 4): for the WX-based backends;
160+
* `cairocffi <https://cairocffi.readthedocs.io/en/latest/>`_ (>= 0.8) or
158161
`pycairo <https://pypi.python.org/pypi/pycairo>`_: for the cairo-based
159-
backends (the latter is required for GTK3Cairo);
162+
backends;
160163
* `Tornado <https://pypi.python.org/pypi/tornado>`_: for the WebAgg backend;
161164

162165
For better support of animation output format and image file formats, LaTeX,
@@ -166,7 +169,7 @@ etc., you can install the following:
166169
<https://libav.org/avconv.html>`_: for saving movies;
167170
* `ImageMagick <https://www.imagemagick.org/script/index.php>`_: for saving
168171
animated gifs;
169-
* `Pillow <https://pillow.readthedocs.io/en/latest/>`_ (>=3.4): for a larger
172+
* `Pillow <https://pillow.readthedocs.io/en/latest/>`_ (>= 3.4): for a larger
170173
selection of image file formats: JPEG, BMP, and TIFF image files;
171174
* `LaTeX <https://miktex.org/>`_ and `GhostScript
172175
<https://ghostscript.com/download/>`_ (for rendering text with LaTeX).
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
Blacklisted rcparams no longer updated by `rcdefaults`, `rc_file_defaults`, `rc_file`
2+
-------------------------------------------------------------------------------------
3+
4+
The rc modifier functions `rcdefaults`, `rc_file_defaults` and `rc_file`
5+
now ignore rcParams in the `matplotlib.style.core.STYLE_BLACKLIST` set. In
6+
particular, this prevents the ``backend`` and ``interactive`` rcParams from
7+
being incorrectly modified by these functions.

doc/api/next_api_changes/2018-02-15-AL-deprecations.rst

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,12 @@ The following classes, methods, functions, and attributes are deprecated:
1414
``RcParams.msg_depr_set``, ``RcParams.msg_obsolete``,
1515
``RcParams.msg_backend_obsolete``,
1616
- ``afm.parse_afm``,
17+
- ``backend_pdf.PdfFile.texFontMap``,
1718
- ``backend_pgf.get_texcommand``,
1819
- ``backend_ps.get_bbox``,
20+
- ``backend_qt5.FigureCanvasQT.keyAutoRepeat`` (directly check
21+
``event.guiEvent.isAutoRepeat()`` in the event handler to decide whether to
22+
handle autorepeated key presses).
1923
- ``backend_qt5.error_msg_qt``, ``backend_qt5.exception_handler``,
2024
- ``backend_wx.FigureCanvasWx.macros``,
2125
- ``cbook.GetRealpathAndStat``, ``cbook.Locked``,
@@ -25,21 +29,21 @@ The following classes, methods, functions, and attributes are deprecated:
2529
- ``contour.ContourLabeler.cl``, ``.cl_xy``, and ``.cl_cvalues``,
2630
- ``dates.DateFormatter.strftime_pre_1900``, ``dates.DateFormatter.strftime``,
2731
- ``font_manager.TempCache``,
32+
- ``image._ImageBase.iterpnames``, use the ``interpolation_names`` property
33+
instead. (this affects classes that inherit from ``_ImageBase`` including
34+
:class:`FigureImage`, :class:`BboxImage`, and :class:`AxesImage`),
2835
- ``mathtext.unichr_safe`` (use ``chr`` instead),
36+
- ``patches.Polygon.xy``,
2937
- ``table.Table.get_child_artists`` (use ``get_children`` instead),
3038
- ``testing.compare.ImageComparisonTest``, ``testing.compare.compare_float``,
3139
- ``testing.decorators.CleanupTest``,
3240
``testing.decorators.skip_if_command_unavailable``,
3341
- ``FigureCanvasQT.keyAutoRepeat`` (directly check
3442
``event.guiEvent.isAutoRepeat()`` in the event handler to decide whether to
3543
handle autorepeated key presses).
36-
- ``FigureCanvasWx.macros``,
37-
- ``_ImageBase.iterpnames``, use the ``interpolation_names`` property instead.
38-
(this affects classes that inherit from ``_ImageBase`` including
39-
:class:`FigureImage`, :class:`BboxImage`, and :class:`AxesImage`),
40-
- ``patches.Polygon.xy``,
4144
- ``texmanager.dvipng_hack_alpha``,
4245
- ``text.Annotation.arrow``,
46+
- ``textpath.TextToPath.tex_font_map``,
4347

4448
The following rcParams are deprecated:
4549
- ``examples.directory`` (use ``datapath`` instead),

doc/devel/coding_guide.rst

Lines changed: 29 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -41,47 +41,59 @@ Documentation
4141
PR Review guidelines
4242
====================
4343

44+
* Be patient and `kind <https://youtu.be/tzFWz5fiVKU?t=49m30s>`__ with
45+
contributors.
46+
4447
* If you have commit rights, then you are trusted to use them. Please
4548
help review and merge PRs!
4649

47-
* For code changes (anything in ``src`` or ``lib``) two developers
48-
(those with commit rights) should review all pull requests. If you
49-
are the first to review a PR and approve of the changes use the
50-
github `'approve review'
50+
* Documentation and examples may be merged by the first reviewer. Use
51+
the threshold "is this better than it was?" as the review criteria.
52+
53+
* For code changes (anything in ``src`` or ``lib``) at least two
54+
developers (those with commit rights) should review all pull
55+
requests. If you are the first to review a PR and approve of the
56+
changes use the github `'approve review'
5157
<https://help.github.com/articles/reviewing-changes-in-pull-requests/>`__
52-
tool to mark it as such. If you are a subsequent reviewer and you
53-
approve, either merge (and backport if needed) or select ``'approve
54-
review'``.
58+
tool to mark it as such. If you are a subsequent reviewer please
59+
approve the review and if you think no more review is needed, merge
60+
the PR.
5561

5662
Ensure that all API changes are documented in
5763
:file:`doc/api/api_changes` and significant new features have and
5864
entry in :file:`doc/user/whats_new`.
5965

60-
* Documentation and examples may be merged by the first reviewer. Use
61-
the threshold "is this better than it was?" as the review criteria.
62-
63-
* Make sure the Travis, Appvyor, and codecov tests are passing before
64-
merging.
66+
* Make sure the Travis, Appvyor, circle, and codecov tests are passing
67+
before merging.
6568

6669
- Whenever a pull request is created or updated, Travis and Appveyor
6770
automatically runs the test suite on all versions of Python
6871
supported by Matplotlib. The `tox` support in Matplotlib may be
6972
useful for testing locally.
7073

71-
* Do not self merge, except for 'small' patches to un-break the CI.
74+
* Do not self merge, except for 'small' patches to un-break the CI or
75+
when another reviewer explicitly allows it (ex, "Approve modulo CI
76+
passing, may self merge when green")
7277

7378
* Squashing is case-by-case. The balance is between burden on the
7479
contributor, keeping a relatively clean history, and keeping a
7580
history usable for bisecting. The only time we are really strict
7681
about it is to eliminate binary files (ex multiple test image
7782
re-generations) and to remove upstream merges.
7883

79-
* Be patient with contributors.
80-
8184
* Do not let perfect be the enemy of the good, particularly for
8285
documentation or example PRs. If you find yourself making many
83-
small suggestions, either open a PR against the original branch or
84-
merge the PR and then open a new PR against upstream.
86+
small suggestions, either open a PR against the original branch,
87+
push changes to the contributor branch, or merge the PR and then
88+
open a new PR against upstream.
89+
90+
* If you push to a contributor branch leave a comment explaining what
91+
you did, ex "I took the liberty of pushing a small clean-up PR to
92+
your branch, thanks for your work.". If you are going to make
93+
substantial changes to the code or intent of the PR please check
94+
with the contributor first.
95+
96+
8597

8698

8799
Branches and Backports

doc/users/whats_new.rst

Lines changed: 21 additions & 1 deletion
< F438 /tr>
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ revision, see the :ref:`github-stats`.
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.
1717
18-
.. include:: next_whats_new/README.rst
18+
.. include:: next_whats_new/README.rst
1919
.. toctree::
2020
:glob:
2121
:maxdepth: 1
@@ -198,6 +198,26 @@ The :class:`matplotlib.widgets.Slider` widget now takes an optional argument
198198
``'vertical'``) that the slider should take.
199199

200200

201+
New convenience methods for GridSpec
202+
------------------------------------
203+
204+
There are new convenience methods for `.gridspec.GridSpec` and
205+
`.gridspec.GridSpecFromSubplotSpec`. Instead of the former we can
206+
now call `.Figure.add_gridspec` and for the latter `.SubplotSpec.subgridspec`.
207+
208+
.. code-block:: python
209+
210+
import matplotlib.pyplot as plt
211+
212+
fig = plt.figure()
213+
gs0 = fig.add_gridspec(3, 1)
214+
ax1 = fig.add_subplot(gs0[0])
215+
ax2 = fig.add_subplot(gs0[1])
216+
gssub = gs0[2].subgridspec(1, 3)
217+
for i in range(3):
218+
fig.add_subplot(gssub[0, i])
219+
220+
201221
202222
203223

examples/color/named_colors.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,25 +25,25 @@
2525

2626
n = len(sorted_names)
2727
ncols = 4
28-
nrows = n // ncols + 1
28+
nrows = n // ncols
2929

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

3232
# Get height and width
3333
X, Y = fig.get_dpi() * fig.get_size_inches()
3434
h = Y / (nrows + 1)
3535
w = X / ncols
3636

3737
for i, name in enumerate(sorted_names):
38-
col = i % ncols
39-
row = i // ncols
38+
row = i % nrows
39+
col = i // nrows
4040
y = Y - (row * h) - h
4141

4242
xi_line = w * (col + 0.05)
4343
xf_line = w * (col + 0.25)
4444
xi_text = w * (col + 0.3)
4545

46-
ax.text(xi_text, y, name, fontsize=(h * 0.8),
46+
ax.text(xi_text, y, name, fontsize=(h * 0.5),
4747
horizontalalignment='left',
4848
verticalalignment='center')
4949

examples/event_handling/ginput_manual_clabel_sgskip.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,9 @@
1414
1515
"""
1616

17-
1817
import time
19-
import matplotlib
18+
2019
import numpy as np
21-
import matplotlib.cm as cm
22-
import matplotlib.mlab as mlab
2320
import matplotlib.pyplot as plt
2421

2522

examples/frontpage/3D.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@
66
This example reproduces the frontpage 3D example.
77
88
"""
9-
from mpl_toolkits.mplot3d import Axes3D
9+
# This import registers the 3D projection, but is otherwise unused.
10+
from mpl_toolkits.mplot3d import Axes3D # noqa: F401 unused import
11+
1012
from matplotlib import cbook
1113
from matplotlib import cm
1214
from matplotlib.colors import LightSource

examples/images_contours_and_fields/contour_label_demo.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212

1313
import matplotlib
1414
import numpy as np
15-
import matplotlib.cm as cm
1615
import matplotlib.ticker as ticker
1716
import matplotlib.pyplot as plt
1817

examples/images_contours_and_fields/figimage_demo.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
"""
99
import numpy as np
1010
import matplotlib
11-
import matplotlib.cm as cm
1211
import matplotlib.pyplot as plt
1312

1413

examples/images_contours_and_fields/quadmesh_demo.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
import copy
1313

14-
from matplotlib import cm, colors, pyplot as plt
14+
from matplotlib import cm, pyplot as plt
1515
import numpy as np
1616

1717
n = 12

examples/images_contours_and_fields/quiver_demo.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
"""
1414
import matplotlib.pyplot as plt
1515
import numpy as np
16-
from numpy import ma
1716

1817
X, Y = np.meshgrid(np.arange(0, 2 * np.pi, .2), np.arange(0, 2 * np.pi, .2))
1918
U = np.cos(X)

examples/lines_bars_and_markers/scatter_symbol.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
"""
99
import matplotlib.pyplot as plt
1010
import numpy as np
11-
import matplotlib
1211

1312
# Fixing random state for reproducibility
1413
np.random.seed(19680801)

examples/misc/load_converter.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
import numpy as np
88
import matplotlib.pyplot as plt
99
import matplotlib.cbook as cbook
10-
import matplotlib.dates as mdates
1110
from matplotlib.dates import bytespdate2num
1211

1312
datafile = cbook.get_sample_data('msft.csv', asfileobj=False)

examples/misc/plotfile_demo.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@
66
Example use of ``plotfile`` to plot data directly from a file.
77
"""
88
import matplotlib.pyplot as plt
9-
import numpy as np
10-
119
import matplotlib.cbook as cbook
1210

1311
fname = cbook.get_sample_data('msft.csv', asfileobj=False)

examples/misc/transoffset.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
import matplotlib.transforms as mtransforms
2424
import numpy as np
2525

26-
from matplotlib.transforms import offset_copy
2726

2827
xs = np.arange(7)
2928
ys = xs**2

examples/mplot3d/2dcollections3d.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@
77
selective axes of a 3D plot.
88
"""
99

10-
from mpl_toolkits.mplot3d import Axes3D
10+
# This import registers the 3D projection, but is otherwise unused.
11+
from mpl_toolkits.mplot3d import Axes3D # noqa: F401 unused import
12+
1113
import numpy as np
1214
import matplotlib.pyplot as plt
1315

examples/mplot3d/3d_bars.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@
1010

1111
import numpy as np
1212
import matplotlib.pyplot as plt
13-
from mpl_toolkits.mplot3d import Axes3D
13+
# This import registers the 3D projection, but is otherwise unused.
14+
from mpl_toolkits.mplot3d import Axes3D # noqa: F401 unused import
1415

1516

1617
# setup the figure and axes

examples/mplot3d/bars3d.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@
77
planes y=0, y=1, etc.
88
"""
99

10-
from mpl_toolkits.mplot3d import Axes3D
10+
# This import registers the 3D projection, but is otherwise unused.
11+
from mpl_toolkits.mplot3d import Axes3D # noqa: F401 unused import
12+
1113
import matplotlib.pyplot as plt
1214
import numpy as np
1315

0 commit comments

Comments
 (0)
0