8000 Merge branch 'main' into aspect_equal_3d · matplotlib/matplotlib@bfd0afe · 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 bfd0afe

Browse files
Merge branch 'main' into aspect_equal_3d
2 parents 0bb940e + 12d3c8e commit bfd0afe

File tree

80 files changed

+1478
-869
lines changed

Some content is hidden

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

80 files changed

+1478
-869
lines changed

.github/ISSUE_TEMPLATE/bug_report.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,9 @@ body:
1515
id: reproduction
1616
attributes:
1717
label: Code for reproduction
18-
description: If possible, please provide a minimum self-contained example.
19-
placeholder: Paste your code here
18+
description: |
19+
If possible, please provide a minimum self-contained example.
20+
placeholder: Paste your code here. This field is automatically formatted as Python code.
2021
render: python
2122
validations:
2223
required: true

.github/workflows/cibuildwheel.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ jobs:
5353
fetch-depth: 0
5454

5555
- name: Build wheels for CPython 3.10
56-
uses: pypa/cibuildwheel@v2.8.0
56+
uses: pypa/cibuildwheel@v2.8.1
5757
env:
5858
CIBW_BUILD: "cp310-*"
5959
CIBW_SKIP: "*-musllinux*"
@@ -66,7 +66,7 @@ jobs:
6666
CIBW_ARCHS: ${{ matrix.cibw_archs }}
6767

6868
- name: Build wheels for CPython 3.9
69-
uses: pypa/cibuildwheel@v2.8.0
69+
uses: pypa/cibuildwheel@v2.8.1
7070
env:
7171
CIBW_BUILD: "cp39-*"
7272
CIBW_SKIP: "*-musllinux*"
@@ -79,7 +79,7 @@ jobs:
7979
CIBW_ARCHS: ${{ matrix.cibw_archs }}
8080

8181
- name: Build wheels for CPython 3.8
82-
uses: pypa/cibuildwheel@v2.8.0
82+
uses: pypa/cibuildwheel@v2.8.1
8383
env:
8484
CIBW_BUILD: "cp38-*"
8585
CIBW_SKIP: "*-musllinux*"
@@ -92,7 +92,7 @@ jobs:
9292
CIBW_ F438 ARCHS: ${{ matrix.cibw_archs }}
9393

9494
- name: Build wheels for PyPy
95-
uses: pypa/cibuildwheel@v2.8.0
95+
uses: pypa/cibuildwheel@v2.8.1
9696
env:
9797
CIBW_BUILD: "pp38-*"
9898
CIBW_SKIP: "*-musllinux*"

doc/api/animation_api.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ artist at a global scope and let Python sort things out. For example ::
111111

112112
fig, ax = plt.subplots()
113113
xdata, ydata = [], []
114-
ln, = plt.plot([], [], 'ro')
114+
ln, = ax.plot([], [], 'ro')
115115

116116
def init():
117117
ax.set_xlim(0, 2*np.pi)

doc/api/index_backend_api.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
``matplotlib.backends``
33
***********************
44

5+
.. module:: matplotlib.backends
6+
57
.. toctree::
68
:maxdepth: 1
79

doc/api/matplotlib_configuration_api.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@
44

55
.. py:currentmodule:: matplotlib
66
7+
.. automodule:: matplotlib
8+
:no-members:
9+
:no-undoc-members:
10+
:noindex:
11+
712
Backend management
813
==================
914

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
``stem(..., markerfmt=...)`` behavior
2+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3+
The behavior of the *markerfmt* parameter of `~.Axes.stem` has changed:
4+
5+
- If *markerfmt* does not contain a color, the color is taken from *linefmt*.
6+
- If *markerfmt* does not contain a marker, the default is 'o'.
7+
8+
Before, *markerfmt* was passed unmodified to ``plot(..., fmt)``, which had
9+
a number of unintended side-effects; e.g. only giving a color switched to
10+
a solid line without markers.
11+
12+
For a simple call ``stem(x, y)`` without parameters, the new rules still
13+
reproduce the old behavior.
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
The pgf backend now uses the article documentclass as basis for compilation
2+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
The markerfacecoloralt parameter to Line2D is now supported by axes.errorbar
2+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3+
- markerfacecoloralt is now passed to the line plotter from axes.errorbar
4+
- Documentation for axes.errorbar how accurately lists which properties are
5+
passed on to Line2D, rather than claiming that all kwargs are passed on
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
Event handlers
2+
~~~~~~~~~~~~~~
3+
The ``draw_event``, ``resize_event``, ``close_event``, ``key_press_event``,
4+
``key_release_event``, ``pick_event``, ``scroll_event``,
5+
``button_press_event``, ``button_release_event``, ``motion_notify_event``,
6+
``enter_notify_event`` and ``leave_notify_event`` methods of `.FigureCanvasBase`
7+
are deprecated. They had inconsistent signatures across backends, and made it
8+
difficult to improve event metadata.
9+
10+
In order to trigger an event on a canvas, directly construct an `.Event` object
11+
of the correct class and call ``canvas.callbacks.process(event.name, event)``.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
``FigureCanvasBase.pick``
2+
~~~~~~~~~~~~~~~~~~~~~~~~~
3+
... is deprecated. Directly call `.Figure.pick`, which has taken over the
4+
responsibility of checking the canvas widgetlock as well.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
``w_xaxis``, ``w_yaxis``, and ``w_zaxis`` of ``Axis3D``
2+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3+
4+
... have been pending deprecation since 3.1. They are now deprecated.
5+
Instead use ``xaxis``, ``yaxis``, and ``zaxis``.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
``Tick.label``
2+
~~~~~~~~~~~~~~
3+
4+
... has been pending deprecation since 3.1 and is now deprecated.
5+
Use ``Tick.label1`` instead.
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
``FigureManagerMac.close`` is deprecated
2+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
``axislines.GridHelperBase.new_gridlines`` and ``axislines.Axes.new_gridlines``
2+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3+
... are deprecated.

doc/conf.py

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -172,25 +172,28 @@ def matplotlib_reduced_latex_scraper(block, block_vars, gallery_conf,
172172

173173

174174
sphinx_gallery_conf = {
175+
'backreferences_dir': Path('api') / Path('_as_gen'),
176+
# Compression is a significant effort that we skip for local and CI builds.
177+
'compress_images': ('thumbnails', 'images') if is_release_build else (),
178+
'doc_module': ('matplotlib', 'mpl_toolkits'),
175179
'examples_dirs': ['../examples', '../tutorials', '../plot_types'],
176180
'filename_pattern': '^((?!sgskip).)*$',
177181
'gallery_dirs': ['gallery', 'tutorials', 'plot_types'],
178-
'doc_module': ('matplotlib', 'mpl_toolkits'),
179-
'reference_url': {
180-
'matplotlib': None,
181-
},
182-
'backreferences_dir': Path('api') / Path('_as_gen'),
183-
'subsection_order': gallery_order.sectionorder,
184-
'within_subsection_order': gallery_order.subsectionorder,
185-
'remove_config_comments': True,
186-
'min_reported_time': 1,
187-
'thumbnail_size': (320, 224),
188182
'image_scrapers': (matplotlib_reduced_latex_scraper, ),
189-
# Compression is a significant effort that we skip for local and CI builds.
190-
'compress_images': ('thumbnails', 'images') if is_release_build else (),
191-
'matplotlib_animations': True,
192183
'image_srcset': ["2x"],
193184
'junit': '../test-results/sphinx-gallery/junit.xml' if CIRCLECI else '',
185+
'matplotlib_animations': True,
186+
'min_reported_time': 1,
187+
'reference_url': {'matplotlib': None},
188+
'remove_config_comments': True,
189+
'reset_modules': (
190+
'matplotlib',
191+
# clear basic_units module to re-register with unit registry on import
192+
lambda gallery_conf, fname: sys.modules.pop('basic_units', None)
193+
),
194+
'subsection_order': gallery_order.sectionorder,
195+
'thumbnail_size': (320, 224),
196+
'within_subsection_order': gallery_order.subsectionorder,
194197
}
195198

196199
mathmpl_fontsize = 11.0

doc/users/explain/backends.rst

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -139,13 +139,13 @@ writing to a file):
139139
Renderer Filetypes Description
140140
======== ========= =======================================================
141141
AGG png raster_ graphics -- high quality images using the
142-
`Anti-Grain Geometry`_ engine
143-
PDF pdf vector_ graphics -- `Portable Document Format`_
144-
PS ps, eps vector_ graphics -- Postscript_ output
145-
SVG svg vector_ graphics -- `Scalable Vector Graphics`_
146-
PGF pgf, pdf vector_ graphics -- using the pgf_ package
142+
`Anti-Grain Geometry`_ engine.
143+
PDF pdf vector_ graphics -- `Portable Document Format`_ output.
144+
PS ps, eps vector_ graphics -- PostScript_ output.
145+
SVG svg vector_ graphics -- `Scalable Vector Graphics`_ output.
146+
PGF pgf, pdf vector_ graphics -- using the pgf_ package.
147147
Cairo png, ps, raster_ or vector_ graphics -- using the Cairo_ library
148-
pdf, svg
148+
pdf, svg (requires pycairo_ or cairocffi_).
149149
======== ========= =======================================================
150150

151151
To save plots using the non-interactive backends, use the
@@ -162,15 +162,15 @@ Backend Description
162162
QtAgg Agg rendering in a Qt_ canvas (requires PyQt_ or `Qt for Python`_,
163163
a.k.a. PySide). This backend can be activated in IPython with
164164
``%matplotlib qt``.
165-
ipympl Agg rendering embedded in a Jupyter widget. (requires ipympl_).
165+
ipympl Agg rendering embedded in a Jupyter widget (requires ipympl_).
166166
This backend can be enabled in a Jupyter notebook with
167167
``%matplotlib ipympl``.
168-
GTK3Agg Agg rendering to a GTK_ 3.x canvas (requires PyGObject_,
169-
and pycairo_ or cairocffi_). This backend can be activated in
170-
IPython with ``%matplotlib gtk3``.
171-
GTK4Agg Agg rendering to a GTK_ 4.x canvas (requires PyGObject_,
172-
and pycairo_ or cairocffi_). This backend can be activated in
173-
IPython with ``%matplotlib gtk4``.
168+
GTK3Agg Agg rendering to a GTK_ 3.x canvas (requires PyGObject_ and
169+
pycairo_). This backend can be activated in IPython with
170+
``%matplotlib gtk3``.
171+
GTK4Agg Agg rendering to a GTK_ 4.x canvas (requires PyGObject_ and
172+
pycairo_). This backend can be activated in IPython with
173+
``%matplotlib gtk4``.
174174
macosx Agg rendering into a Cocoa canvas in OSX. This backend can be
175175
activated in IPython with ``%matplotlib osx``.
176176
TkAgg Agg rendering to a Tk_ canvas (requires TkInter_). This
@@ -180,10 +180,10 @@ nbAgg Embed an interactive figure in a Jupyter classic notebook. This
180180
``%matplotlib notebook``.
181181
WebAgg On ``show()`` will start a tornado server with an interactive
182182
figure.
183-
GTK3Cairo Cairo rendering to a GTK_ 3.x canvas (requires PyGObject_,
184-
and pycairo_ or cairocffi_).
185-
GTK4Cairo Cairo rendering to a GTK_ 4.x canvas (requires PyGObject_,
186-
and pycairo_ or cairocffi_).
183+
GTK3Cairo Cairo rendering to a GTK_ 3.x canvas (requires PyGObject_ and
184+
pycairo_).
185+
GTK4Cairo Cairo rendering to a GTK_ 4.x canvas (requires PyGObject_ and
186+
pycairo_).
187187
wxAgg Agg rendering to a wxWidgets_ canvas (requires wxPython_ 4).
188188
This backend can be activated in IPython with ``%matplotlib wx``.
189189
========= ================================================================
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
Legend can control alignment of title and handles
2+
-------------------------------------------------
3+
4+
`.Legend` now supports control the alignment of title and handles via the
5+
keyword argument ``alignment``. You can also use `.Legend.set_alignment`
6+
to control the alignment on existing Legends.

doc/users/next_whats_new/strnorm.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
Setting norms with strings
2+
~~~~~~~~~~~~~~~~~~~~~~~~~~
3+
Norms can now be set (e.g. on images) using the string name of the
4+
corresponding scale, e.g. ``imshow(array, norm="log")``. Note that in that
5+
case, it is permissible to also pass *vmin* and *vmax*, as a new Norm instance
6+
will be created under the hood.

examples/axisartist/demo_floating_axes.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ def setup_axes1(fig, rect):
4141

4242
ax1 = fig.add_subplot(
4343
rect, axes_class=floating_axes.FloatingAxes, grid_helper=grid_helper)
44+
ax1.grid()
4445

4546
aux_ax = ax1.get_aux_axes(tr)
4647

@@ -72,6 +73,7 @@ def setup_axes2(fig, rect):
7273

7374
ax1 = fig.add_subplot(
7475
rect, axes_class=floating_axes.FloatingAxes, grid_helper=grid_helper)
76+
ax1.grid()
7577

7678
# create a parasite axes whose transData in RA, cz
7779
aux_ax = ax1.get_aux_axes(tr)
@@ -129,6 +131,7 @@ def setup_axes3(fig, rect):
129131

130132
ax1.axis["left"].label.set_text(r"cz [km$^{-1}$]")
131133
ax1.axis["top"].label.set_text(r"$\alpha_{1950}$")
134+
ax1.grid()
132135

133136
# create a parasite axes whose transData in RA, cz
134137
aux_ax = ax1.get_aux_axes(tr)

examples/misc/image_thumbnail_sgskip.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
description="Build thumbnails of all images in a directory.")
2121
parser.add_argument("imagedir", type=Path)
2222
args = parser.parse_args()
23-
if not args.imagedir.isdir():
23+
if not args.imagedir.is_dir():
2424
sys.exit(f"Could not find input directory {args.imagedir}")
2525

2626
outdir = Path("thumbs")

examples/showcase/stock_prices.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ def convertdate(x):
102102
# Finally, save the figure as a PNG.
103103
# You can also save it as a PDF, JPEG, etc.
104104
# Just change the file extension in this call.
105-
# fig.savefig('percent-bachelors-degrees-women-usa.png', bbox_inches='tight')
105+
# fig.savefig('stock-prices.png', bbox_inches='tight')
106106
plt.show()
107107

108108
#############################################################################

examples/user_interfaces/embedding_in_gtk3_panzoom_sgskip.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
vbox.pack_start(canvas, True, True, 0)
3737

3838
# Create toolbar
39-
toolbar = NavigationToolbar(canvas, win)
39+
toolbar = NavigationToolbar(canvas)
4040
vbox.pack_start(toolbar, False, False, 0)
4141

4242
win.show_all()

examples/user_interfaces/embedding_in_gtk4_panzoom_sgskip.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ def on_activate(app):
3939
vbox.append(canvas)
4040

4141
# Create toolbar
42-
toolbar = NavigationToolbar(canvas, win)
42+
toolbar = NavigationToolbar(canvas)
4343
vbox.append(toolbar)
4444

4545
win.show()

examples/user_interfaces/embedding_in_wx5_sgskip.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
import wx.lib.agw.aui as aui
1010
import wx.lib.mixins.inspection as wit
1111

12-
import matplotlib as mpl
12+
from matplotlib.figure import Figure
1313
from matplotlib.backends.backend_wxagg import (
1414
FigureCanvasWxAgg as FigureCanvas,
1515
NavigationToolbar2WxAgg as NavigationToolbar)
@@ -18,7 +18,7 @@
1818
class Plot(wx.Panel):
1919
def __init__(self, parent, id=-1, dpi=None, **kwargs):
2020
super().__init__(parent, id=id, **kwargs)
21-
self.figure = mpl.figure.Figure(dpi=dpi, figsize=(2, 2))
21+
self.figure = Figure(dpi=dpi, figsize=(2, 2))
2222
self.canvas = FigureCanvas(self, -1, self.figure)
2323
self.toolbar = NavigationToolbar(self.canvas)
2424
self.toolbar.Realize()

examples/user_interfaces/fourier_demo_wx_sgskip.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,10 +75,10 @@ def __init__(self, parent, label, param):
7575

7676
sizer = wx.BoxSizer(wx.HORIZONTAL)
7777
sizer.Add(self.sliderLabel, 0,
78-
wx.EXPAND | wx.ALIGN_CENTER | wx.ALL,
78+
wx.EXPAND | wx.ALL,
7979
border=2)
8080
sizer.Add(self.sliderText, 0,
81-
wx.EXPAND | wx.ALIGN_CENTER | wx.ALL,
81+
wx.EXPAND | wx.ALL,
8282
border=2)
8383
sizer.Add(self.slider, 1, wx.EXPAND)
8484
self.sizer = sizer
@@ -115,9 +115,9 @@ def __init__(self, *args, **kwargs):
115115
sizer = wx.BoxSizer(wx.VERTICAL)
116116
sizer.Add(self.canvas, 1, wx.EXPAND)
117117
sizer.Add(self.frequencySliderGroup.sizer, 0,
118-
wx.EXPAND | wx.ALIGN_CENTER | wx.ALL, border=5)
118+
wx.EXPAND | wx.ALL, border=5)
119119
sizer.Add(self.amplitudeSliderGroup.sizer, 0,
120-
wx.EXPAND | wx.ALIGN_CENTER | wx.ALL, border=5)
120+
wx.EXPAND | wx.ALL, border=5)
121121
panel.SetSizer(sizer)
122122

123123
def createCanvas(self, parent):

examples/user_interfaces/mathtext_wx_sgskip.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
import numpy as np
1616
import wx
1717

18-
IS_GTK = 'wxGTK' in wx.PlatformInfo
1918
IS_WIN = 'wxMSW' in wx.PlatformInfo
2019

2120

@@ -66,7 +65,7 @@ def __init__(self, parent, title):
6665
menuBar.Append(menu, "&File")
6766
self.Bind(wx.EVT_MENU, self.OnClose, m_exit)
6867

69-
if IS_GTK or IS_WIN:
68+
if IS_WIN:
7069
# Equation Menu
7170
menu = wx.Menu()
7271
for i, (mt, func) in enumerate(functions):

lib/matplotlib/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@
8181
developed and maintained by a host of others.
8282
8383
Occasionally the internal documentation (python docstrings) will refer
84-
to MATLAB®, a registered trademark of The MathWorks, Inc.
84+
to MATLAB®, a registered trademark of The MathWorks, Inc.
8585
8686
"""
8787

lib/matplotlib/_mathtext.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1935,13 +1935,17 @@ def non_math(self, s, loc, toks):
19351935
float_literal = staticmethod(pyparsing_common.convertToFloat)
19361936

19371937
def _make_space(self, percentage):
1938-
# All spaces are relative to em width
1938+
# In TeX, an em (the unit usually used to measure horizontal lengths)
1939+
# is not the width of the character 'm'; it is the same in different
1940+
# font styles (e.g. roman or italic). Mathtext, however, uses 'm' in
1941+
# the italic style so that horizontal spaces don't depend on the
1942+
# current font style.
19391943
state = self.get_state()
19401944
key = (state.font, state.fontsize, state.dpi)
19411945
width = self._em_width_cache.get(key)
19421946
if width is None:
19431947
metrics = state.font_output.get_metrics(
1944-
state.font, mpl.rcParams['mathtext.default'], 'm',
1948+
'it', mpl.rcParams['mathtext.default'], 'm',
19451949
state.fontsize, state.dpi)
19461950
width = metrics.advance
19471951
self._em_width_cache[key] = width

0 commit comments

Comments
 (0)
0