From 8e2d7914a2c8943187405661be3e876537c32e54 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Wed, 14 Aug 2024 16:44:38 -0400 Subject: [PATCH 001/131] TST: Guard against PyGObject existing, but not gobject-introspection --- lib/matplotlib/tests/test_backends_interactive.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/lib/matplotlib/tests/test_backends_interactive.py b/lib/matplotlib/tests/test_backends_interactive.py index d624b5db0ac2..2c6b61a48438 100644 --- a/lib/matplotlib/tests/test_backends_interactive.py +++ b/lib/matplotlib/tests/test_backends_interactive.py @@ -81,10 +81,18 @@ def _get_available_interactive_backends(): elif env["MPLBACKEND"] == 'macosx' and os.environ.get('TF_BUILD'): reason = "macosx backend fails on Azure" elif env["MPLBACKEND"].startswith('gtk'): - import gi # type: ignore + try: + import gi # type: ignore + except ImportError: + # Though we check that `gi` exists above, it is possible that its + # C-level dependencies are not available, and then it still raises an + # `ImportError`, so guard against that. + available_gtk_versions = [] + else: + gi_repo = gi.Repository.get_default() + available_gtk_versions = gi_repo.enumerate_versions('Gtk') version = env["MPLBACKEND"][3] - repo = gi.Repository.get_default() - if f'{version}.0' not in repo.enumerate_versions('Gtk'): + if f'{version}.0' not in available_gtk_versions: reason = "no usable GTK bindings" marks = [] if reason: From f6b32660a348aa027b25709cc3d8218b017e8db5 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Wed, 14 Aug 2024 17:02:23 -0400 Subject: [PATCH 002/131] BLD: Avoid pybind11 2.13.3 due to Windows quoting bug See https://github.com/pybind/pybind11/issues/5300#issuecomment-2287698500 --- pyproject.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 52bbe308c0f9..891ef87e4342 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -49,7 +49,7 @@ requires-python = ">=3.9" dev = [ "meson-python>=0.13.1", "numpy>=1.25", - "pybind11>=2.6", + "pybind11>=2.6,!=2.13.3", "setuptools_scm>=7", # Not required by us but setuptools_scm without a version, cso _if_ # installed, then setuptools_scm 8 requires at least this version. @@ -73,7 +73,7 @@ build-backend = "mesonpy" # Also keep in sync with optional dependencies above. requires = [ "meson-python>=0.13.1", - "pybind11>=2.6", + "pybind11>=2.6,!=2.13.3", "setuptools_scm>=7", # Comments on numpy build requirement range: From cb124887a10c2e69e70974847a47f320353e791c Mon Sep 17 00:00:00 2001 From: hannah Date: Thu, 15 Aug 2024 18:21:14 -0400 Subject: [PATCH 003/131] Backport PR #28732: Renames the minumumSizeHint method to minimumSizeHint --- lib/matplotlib/backends/backend_qt.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/matplotlib/backends/backend_qt.py b/lib/matplotlib/backends/backend_qt.py index 6603883075d4..242c6fdbf9f9 100644 --- a/lib/matplotlib/backends/backend_qt.py +++ b/lib/matplotlib/backends/backend_qt.py @@ -393,7 +393,7 @@ def sizeHint(self): w, h = self.get_width_height() return QtCore.QSize(w, h) - def minumumSizeHint(self): + def minimumSizeHint(self): return QtCore.QSize(10, 10) @staticmethod From 3900fa24aa082c1727ca274b98747933f1578671 Mon Sep 17 00:00:00 2001 From: Ruth Comer <10599679+rcomer@users.noreply.github.com> Date: Wed, 21 Aug 2024 08:22:23 +0100 Subject: [PATCH 004/131] Backport PR #28737: TST: Fix image comparison directory for test_striped_lines --- lib/matplotlib/tests/test_collections.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/matplotlib/tests/test_collections.py b/lib/matplotlib/tests/test_collections.py index 23e951b17a2f..c4f98d4eeb45 100644 --- a/lib/matplotlib/tests/test_collections.py +++ b/lib/matplotlib/tests/test_collections.py @@ -1316,7 +1316,6 @@ def test_check_offsets_dtype(): @pytest.mark.parametrize('gapcolor', ['orange', ['r', 'k']]) @check_figures_equal(extensions=['png']) -@mpl.rc_context({'lines.linewidth': 20}) def test_striped_lines(fig_test, fig_ref, gapcolor): ax_test = fig_test.add_subplot(111) ax_ref = fig_ref.add_subplot(111) @@ -1328,11 +1327,12 @@ def test_striped_lines(fig_test, fig_ref, gapcolor): x = range(1, 6) linestyles = [':', '-', '--'] - ax_test.vlines(x, 0, 1, linestyle=linestyles, gapcolor=gapcolor, alpha=0.5) + ax_test.vlines(x, 0, 1, linewidth=20, linestyle=linestyles, gapcolor=gapcolor, + alpha=0.5) if isinstance(gapcolor, str): gapcolor = [gapcolor] for x, gcol, ls in zip(x, itertools.cycle(gapcolor), itertools.cycle(linestyles)): - ax_ref.axvline(x, 0, 1, linestyle=ls, gapcolor=gcol, alpha=0.5) + ax_ref.axvline(x, 0, 1, linewidth=20, linestyle=ls, gapcolor=gcol, alpha=0.5) From fc5bc4a50b6c16cde5e21e122fb370862b56148c Mon Sep 17 00:00:00 2001 From: Ruth Comer <10599679+rcomer@users.noreply.github.com> Date: Wed, 21 Aug 2024 10:17:02 +0100 Subject: [PATCH 005/131] Backport PR #28739: Tweak interactivity docs wording (and fix capitalization). --- galleries/users_explain/figure/event_handling.rst | 15 +++++++++------ galleries/users_explain/figure/interactive.rst | 2 +- .../users_explain/figure/interactive_guide.rst | 2 +- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/galleries/users_explain/figure/event_handling.rst b/galleries/users_explain/figure/event_handling.rst index 49d73afeb366..32da038634ae 100644 --- a/galleries/users_explain/figure/event_handling.rst +++ b/galleries/users_explain/figure/event_handling.rst @@ -251,7 +251,8 @@ is created every time a mouse is pressed:: def __call__(self, event): print('click', event) - if event.inaxes!=self.line.axes: return + if event.inaxes != self.line.axes: + return self.xs.append(event.xdata) self.ys.append(event.ydata) self.line.set_data(self.xs, self.ys) @@ -277,17 +278,19 @@ event.ydata)``. In addition to the ``LocationEvent`` attributes, it also has: Draggable rectangle exercise ---------------------------- -Write draggable rectangle class that is initialized with a +Write a draggable rectangle class that is initialized with a `.Rectangle` instance but will move its ``xy`` -location when dragged. Hint: you will need to store the original -``xy`` location of the rectangle which is stored as rect.xy and +location when dragged. + +Hint: You will need to store the original +``xy`` location of the rectangle which is stored as ``rect.xy`` and connect to the press, motion and release mouse events. When the mouse is pressed, check to see if the click occurs over your rectangle (see `.Rectangle.contains`) and if it does, store -the rectangle xy and the location of the mouse click in data coords. +the rectangle xy and the location of the mouse click in data coordinates. In the motion event callback, compute the deltax and deltay of the mouse movement, and add those deltas to the origin of the rectangle -you stored. The redraw the figure. On the button release event, just +you stored, then redraw the figure. On the button release event, just reset all the button press data you stored as None. Here is the solution:: diff --git a/galleries/users_explain/figure/interactive.rst b/galleries/users_explain/figure/interactive.rst index 6fd908fcac7a..b06283152e50 100644 --- a/galleries/users_explain/figure/interactive.rst +++ b/galleries/users_explain/figure/interactive.rst @@ -10,7 +10,7 @@ Interactive figures =================== -When working with data, interactivity can be invaluable. The pan/zoom and +Interactivity can be invaluable when exploring plots. The pan/zoom and mouse-location tools built into the Matplotlib GUI windows are often sufficient, but you can also use the event system to build customized data exploration tools. diff --git a/galleries/users_explain/figure/interactive_guide.rst b/galleries/users_explain/figure/interactive_guide.rst index 3b6f527f6d42..b08231e84f7e 100644 --- a/galleries/users_explain/figure/interactive_guide.rst +++ b/galleries/users_explain/figure/interactive_guide.rst @@ -236,7 +236,7 @@ which would poll for new data and update the figure at 1Hz. .. _spin_event_loop: -Explicitly spinning the event Loop +Explicitly spinning the event loop ---------------------------------- .. autosummary:: From cbc42296dce9d199ef6f33ee6a893ebb11fbfac5 Mon Sep 17 00:00:00 2001 From: Ruth Comer <10599679+rcomer@users.noreply.github.com> Date: Wed, 21 Aug 2024 10:17:02 +0100 Subject: [PATCH 006/131] Backport PR #28739: Tweak interactivity docs wording (and fix capitalization). --- galleries/users_explain/figure/event_handling.rst | 15 +++++++++------ galleries/users_explain/figure/interactive.rst | 2 +- .../users_explain/figure/interactive_guide.rst | 2 +- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/galleries/users_explain/figure/event_handling.rst b/galleries/users_explain/figure/event_handling.rst index 49d73afeb366..32da038634ae 100644 --- a/galleries/users_explain/figure/event_handling.rst +++ b/galleries/users_explain/figure/event_handling.rst @@ -251,7 +251,8 @@ is created every time a mouse is pressed:: def __call__(self, event): print('click', event) - if event.inaxes!=self.line.axes: return + if event.inaxes != self.line.axes: + return self.xs.append(event.xdata) self.ys.append(event.ydata) self.line.set_data(self.xs, self.ys) @@ -277,17 +278,19 @@ event.ydata)``. In addition to the ``LocationEvent`` attributes, it also has: Draggable rectangle exercise ---------------------------- -Write draggable rectangle class that is initialized with a +Write a draggable rectangle class that is initialized with a `.Rectangle` instance but will move its ``xy`` -location when dragged. Hint: you will need to store the original -``xy`` location of the rectangle which is stored as rect.xy and +location when dragged. + +Hint: You will need to store the original +``xy`` location of the rectangle which is stored as ``rect.xy`` and connect to the press, motion and release mouse events. When the mouse is pressed, check to see if the click occurs over your rectangle (see `.Rectangle.contains`) and if it does, store -the rectangle xy and the location of the mouse click in data coords. +the rectangle xy and the location of the mouse click in data coordinates. In the motion event callback, compute the deltax and deltay of the mouse movement, and add those deltas to the origin of the rectangle -you stored. The redraw the figure. On the button release event, just +you stored, then redraw the figure. On the button release event, just reset all the button press data you stored as None. Here is the solution:: diff --git a/galleries/users_explain/figure/interactive.rst b/galleries/users_explain/figure/interactive.rst index 6fd908fcac7a..b06283152e50 100644 --- a/galleries/users_explain/figure/interactive.rst +++ b/galleries/users_explain/figure/interactive.rst @@ -10,7 +10,7 @@ Interactive figures =================== -When working with data, interactivity can be invaluable. The pan/zoom and +Interactivity can be invaluable when exploring plots. The pan/zoom and mouse-location tools built into the Matplotlib GUI windows are often sufficient, but you can also use the event system to build customized data exploration tools. diff --git a/galleries/users_explain/figure/interactive_guide.rst b/galleries/users_explain/figure/interactive_guide.rst index 3b6f527f6d42..b08231e84f7e 100644 --- a/galleries/users_explain/figure/interactive_guide.rst +++ b/galleries/users_explain/figure/interactive_guide.rst @@ -236,7 +236,7 @@ which would poll for new data and update the figure at 1Hz. .. _spin_event_loop: -Explicitly spinning the event Loop +Explicitly spinning the event loop ---------------------------------- .. autosummary:: From d9d1a4d3f6612e9349f1607f46f359bdce8934f6 Mon Sep 17 00:00:00 2001 From: Tim Hoffmann <2836374+timhoffm@users.noreply.github.com> Date: Thu, 22 Aug 2024 10:20:39 +0200 Subject: [PATCH 007/131] Backport PR #28743: Minor fixes in ticker docs --- lib/matplotlib/ticker.py | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/lib/matplotlib/ticker.py b/lib/matplotlib/ticker.py index 2b00937f9e29..d824bbe3b6e2 100644 --- a/lib/matplotlib/ticker.py +++ b/lib/matplotlib/ticker.py @@ -435,10 +435,10 @@ class ScalarFormatter(Formatter): lim = (1_000_000, 1_000_010) fig, (ax1, ax2, ax3) = plt.subplots(3, 1, gridspec_kw={'hspace': 2}) - ax1.set(title='offset_notation', xlim=lim) + ax1.set(title='offset notation', xlim=lim) ax2.set(title='scientific notation', xlim=lim) ax2.xaxis.get_major_formatter().set_useOffset(False) - ax3.set(title='floating point notation', xlim=lim) + ax3.set(title='floating-point notation', xlim=lim) ax3.xaxis.get_major_formatter().set_useOffset(False) ax3.xaxis.get_major_formatter().set_scientific(False) @@ -1146,10 +1146,10 @@ def __init__( Parameters ---------- use_overline : bool, default: False - If x > 1/2, with x = 1-v, indicate if x should be displayed as - $\overline{v}$. The default is to display $1-v$. + If x > 1/2, with x = 1 - v, indicate if x should be displayed as + $\overline{v}$. The default is to display $1 - v$. - one_half : str, default: r"\frac{1}{2}" + one_half : str, default: r"\\frac{1}{2}" The string used to represent 1/2. minor : bool, default: False @@ -1179,9 +1179,9 @@ def use_overline(self, use_overline): Parameters ---------- - use_overline : bool, default: False - If x > 1/2, with x = 1-v, indicate if x should be displayed as - $\overline{v}$. The default is to display $1-v$. + use_overline : bool + If x > 1/2, with x = 1 - v, indicate if x should be displayed as + $\overline{v}$. The default is to display $1 - v$. """ self._use_overline = use_overline @@ -1189,7 +1189,7 @@ def set_one_half(self, one_half): r""" Set the way one half is displayed. - one_half : str, default: r"\frac{1}{2}" + one_half : str The string used to represent 1/2. """ self._one_half = one_half @@ -1707,14 +1707,14 @@ def tick_values(self, vmin, vmax): class FixedLocator(Locator): - """ + r""" Place ticks at a set of fixed values. If *nbins* is None ticks are placed at all values. Otherwise, the *locs* array of - possible positions will be subsampled to keep the number of ticks <= - :math:`nbins* +1`. The subsampling will be done to include the smallest absolute - value; for example, if zero is included in the array of possibilities, then it of - the chosen ticks. + possible positions will be subsampled to keep the number of ticks + :math:`\leq nbins + 1`. The subsampling will be done to include the smallest + absolute value; for example, if zero is included in the array of possibilities, then + it will be included in the chosen ticks. """ def __init__(self, locs, nbins=None): @@ -1861,9 +1861,9 @@ def __init__(self, base=1.0, offset=0.0): """ Parameters ---------- - base : float > 0 + base : float > 0, default: 1.0 Interval between ticks. - offset : float + offset : float, default: 0.0 Value added to each multiple of *base*. .. versionadded:: 3.8 @@ -1877,9 +1877,9 @@ def set_params(self, base=None, offset=None): Parameters ---------- - base : float > 0 + base : float > 0, optional Interval between ticks. - offset : float + offset : float, optional Value added to each multiple of *base*. .. versionadded:: 3.8 From 83251ac2a1d780dc4af2bacab07b43552c5b7a70 Mon Sep 17 00:00:00 2001 From: Thomas A Caswell Date: Thu, 22 Aug 2024 14:50:03 -0400 Subject: [PATCH 008/131] Backport PR #28271: Fix draggable legend disappearing when picking while use_blit=True --- lib/matplotlib/offsetbox.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/lib/matplotlib/offsetbox.py b/lib/matplotlib/offsetbox.py index 32c5bafcde1d..194b950a8a30 100644 --- a/lib/matplotlib/offsetbox.py +++ b/lib/matplotlib/offsetbox.py @@ -1486,11 +1486,13 @@ def on_motion(self, evt): self.canvas.draw() def on_pick(self, evt): - if self._check_still_parented() and evt.artist == self.ref_artist: - self.mouse_x = evt.mouseevent.x - self.mouse_y = evt.mouseevent.y - self.got_artist = True - if self._use_blit: + if self._check_still_parented(): + if evt.artist == self.ref_artist: + self.mouse_x = evt.mouseevent.x + self.mouse_y = evt.mouseevent.y + self.save_offset() + self.got_artist = True + if self.got_artist and self._use_blit: self.ref_artist.set_animated(True) self.canvas.draw() self.background = \ @@ -1498,13 +1500,15 @@ def on_pick(self, evt): self.ref_artist.draw( self.ref_artist.figure._get_renderer()) self.canvas.blit() - self.save_offset() def on_release(self, event): if self._check_still_parented() and self.got_artist: self.finalize_offset() self.got_artist = False if self._use_blit: + self.canvas.restore_region(self.background) + self.ref_artist.draw(self.ref_artist.figure._get_renderer()) + self.canvas.blit() self.ref_artist.set_animated(False) def _check_still_parented(self): From 4439116246b1f74e6dda7a11d96602c3912c01b9 Mon Sep 17 00:00:00 2001 From: Ruth Comer <10599679+rcomer@users.noreply.github.com> Date: Sat, 7 Sep 2024 14:33:56 +0100 Subject: [PATCH 009/131] Backport PR #28706: Add Returns info to to_jshtml docstring --- lib/matplotlib/animation.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/matplotlib/animation.py b/lib/matplotlib/animation.py index 5a4764f1a79f..b402c5fdb4da 100644 --- a/lib/matplotlib/animation.py +++ b/lib/matplotlib/animation.py @@ -1311,6 +1311,12 @@ def to_jshtml(self, fps=None, embed_frames=True, default_mode=None): What to do when the animation ends. Must be one of ``{'loop', 'once', 'reflect'}``. Defaults to ``'loop'`` if the *repeat* parameter is True, otherwise ``'once'``. + + Returns + ------- + str + An HTML representation of the animation embedded as a js object as + produced with the `.HTMLWriter`. """ if fps is None and hasattr(self, '_interval'): # Convert interval in ms to frames per second From 7c370eac988c51dea9d6fca285636ebfcdeba55c Mon Sep 17 00:00:00 2001 From: Ruth Comer <10599679+rcomer@users.noreply.github.com> Date: Sun, 8 Sep 2024 08:44:57 +0100 Subject: [PATCH 010/131] Backport PR #28790: DOC: Fix duplicate Figure.set_dpi entry --- doc/api/figure_api.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/api/figure_api.rst b/doc/api/figure_api.rst index 2371e5a9a863..5dd3adbfec9f 100644 --- a/doc/api/figure_api.rst +++ b/doc/api/figure_api.rst @@ -91,7 +91,7 @@ Figure geometry Figure.get_figwidth Figure.dpi Figure.set_dpi - Figure.set_dpi + Figure.get_dpi Subplot layout -------------- From cf7e7ae718ced0a8b2bbf7aa2d30b141fa5eeb8c Mon Sep 17 00:00:00 2001 From: Ruth Comer <10599679+rcomer@users.noreply.github.com> Date: Sun, 8 Sep 2024 08:44:57 +0100 Subject: [PATCH 011/131] Backport PR #28790: DOC: Fix duplicate Figure.set_dpi entry --- doc/api/figure_api.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/api/figure_api.rst b/doc/api/figure_api.rst index 2371e5a9a863..5dd3adbfec9f 100644 --- a/doc/api/figure_api.rst +++ b/doc/api/figure_api.rst @@ -91,7 +91,7 @@ Figure geometry Figure.get_figwidth Figure.dpi Figure.set_dpi - Figure.set_dpi + Figure.get_dpi Subplot layout -------------- From 88309f528843195ec1e25d75ea5cf148a40bcd8d Mon Sep 17 00:00:00 2001 From: Thomas A Caswell Date: Wed, 11 Sep 2024 16:54:17 -0400 Subject: [PATCH 012/131] Backport PR #28798: DOC: Correctly list modules that have been internalized --- doc/api/_afm_api.rst | 8 ++++++++ doc/api/_docstring_api.rst | 8 ++++++++ doc/api/_tight_bbox_api.rst | 8 ++++++++ doc/api/_tight_layout_api.rst | 8 ++++++++ doc/api/_type1font.rst | 8 ++++++++ doc/api/afm_api.rst | 13 ------------- doc/api/docstring_api.rst | 13 ------------- doc/api/index.rst | 10 +++++----- doc/api/tight_bbox_api.rst | 13 ------------- doc/api/tight_layout_api.rst | 13 ------------- doc/api/type1font.rst | 13 ------------- 11 files changed, 45 insertions(+), 70 deletions(-) create mode 100644 doc/api/_afm_api.rst create mode 100644 doc/api/_docstring_api.rst create mode 100644 doc/api/_tight_bbox_api.rst create mode 100644 doc/api/_tight_layout_api.rst create mode 100644 doc/api/_type1font.rst delete mode 100644 doc/api/afm_api.rst delete mode 100644 doc/api/docstring_api.rst delete mode 100644 doc/api/tight_bbox_api.rst delete mode 100644 doc/api/tight_layout_api.rst delete mode 100644 doc/api/type1font.rst diff --git a/doc/api/_afm_api.rst b/doc/api/_afm_api.rst new file mode 100644 index 000000000000..4e2ac4997272 --- /dev/null +++ b/doc/api/_afm_api.rst @@ -0,0 +1,8 @@ +******************* +``matplotlib._afm`` +******************* + +.. automodule:: matplotlib._afm + :members: + :undoc-members: + :show-inheritance: diff --git a/doc/api/_docstring_api.rst b/doc/api/_docstring_api.rst new file mode 100644 index 000000000000..040a3653a87b --- /dev/null +++ b/doc/api/_docstring_api.rst @@ -0,0 +1,8 @@ +************************* +``matplotlib._docstring`` +************************* + +.. automodule:: matplotlib._docstring + :members: + :undoc-members: + :show-inheritance: diff --git a/doc/api/_tight_bbox_api.rst b/doc/api/_tight_bbox_api.rst new file mode 100644 index 000000000000..826e051fcf6d --- /dev/null +++ b/doc/api/_tight_bbox_api.rst @@ -0,0 +1,8 @@ +************************** +``matplotlib._tight_bbox`` +************************** + +.. automodule:: matplotlib._tight_bbox + :members: + :undoc-members: + :show-inheritance: diff --git a/doc/api/_tight_layout_api.rst b/doc/api/_tight_layout_api.rst new file mode 100644 index 000000000000..ac4f66f280e1 --- /dev/null +++ b/doc/api/_tight_layout_api.rst @@ -0,0 +1,8 @@ +**************************** +``matplotlib._tight_layout`` +**************************** + +.. automodule:: matplotlib._tight_layout + :members: + :undoc-members: + :show-inheritance: diff --git a/doc/api/_type1font.rst b/doc/api/_type1font.rst new file mode 100644 index 000000000000..1a9ff2292887 --- /dev/null +++ b/doc/api/_type1font.rst @@ -0,0 +1,8 @@ +************************* +``matplotlib._type1font`` +************************* + +.. automodule:: matplotlib._type1font + :members: + :undoc-members: + :show-inheritance: diff --git a/doc/api/afm_api.rst b/doc/api/afm_api.rst deleted file mode 100644 index bcae04150909..000000000000 --- a/doc/api/afm_api.rst +++ /dev/null @@ -1,13 +0,0 @@ -****************** -``matplotlib.afm`` -****************** - -.. attention:: - This module is considered internal. - - Its use is deprecated and it will be removed in a future version. - -.. automodule:: matplotlib._afm - :members: - :undoc-members: - :show-inheritance: diff --git a/doc/api/docstring_api.rst b/doc/api/docstring_api.rst deleted file mode 100644 index 38a73a2e83d1..000000000000 --- a/doc/api/docstring_api.rst +++ /dev/null @@ -1,13 +0,0 @@ -************************ -``matplotlib.docstring`` -************************ - -.. attention:: - This module is considered internal. - - Its use is deprecated and it will be removed in a future version. - -.. automodule:: matplotlib._docstring - :members: - :undoc-members: - :show-inheritance: diff --git a/doc/api/index.rst b/doc/api/index.rst index 70c3b5343e7a..53f397a6817a 100644 --- a/doc/api/index.rst +++ b/doc/api/index.rst @@ -79,7 +79,6 @@ Alphabetical list of modules: :maxdepth: 1 matplotlib_configuration_api.rst - afm_api.rst animation_api.rst artist_api.rst axes_api.rst @@ -98,7 +97,6 @@ Alphabetical list of modules: container_api.rst contour_api.rst dates_api.rst - docstring_api.rst dviread.rst figure_api.rst font_manager_api.rst @@ -134,16 +132,18 @@ Alphabetical list of modules: text_api.rst texmanager_api.rst ticker_api.rst - tight_bbox_api.rst - tight_layout_api.rst transformations.rst tri_api.rst - type1font.rst typing_api.rst units_api.rst widgets_api.rst + _afm_api.rst _api_api.rst + _docstring_api.rst _enums_api.rst + _type1font.rst + _tight_bbox_api.rst + _tight_layout_api.rst toolkits/mplot3d.rst toolkits/axes_grid1.rst toolkits/axisartist.rst diff --git a/doc/api/tight_bbox_api.rst b/doc/api/tight_bbox_api.rst deleted file mode 100644 index 9e8dd2fa66f9..000000000000 --- a/doc/api/tight_bbox_api.rst +++ /dev/null @@ -1,13 +0,0 @@ -************************* -``matplotlib.tight_bbox`` -************************* - -.. attention:: - This module is considered internal. - - Its use is deprecated and it will be removed in a future version. - -.. automodule:: matplotlib._tight_bbox - :members: - :undoc-members: - :show-inheritance: diff --git a/doc/api/tight_layout_api.rst b/doc/api/tight_layout_api.rst deleted file mode 100644 index 35f92e3ddced..000000000000 --- a/doc/api/tight_layout_api.rst +++ /dev/null @@ -1,13 +0,0 @@ -*************************** -``matplotlib.tight_layout`` -*************************** - -.. attention:: - This module is considered internal. - - Its use is deprecated and it will be removed in a future version. - -.. automodule:: matplotlib._tight_layout - :members: - :undoc-members: - :show-inheritance: diff --git a/doc/api/type1font.rst b/doc/api/type1font.rst deleted file mode 100644 index 00ef38f4d447..000000000000 --- a/doc/api/type1font.rst +++ /dev/null @@ -1,13 +0,0 @@ -************************ -``matplotlib.type1font`` -************************ - -.. attention:: - This module is considered internal. - - Its use is deprecated and it will be removed in a future version. - -.. automodule:: matplotlib._type1font - :members: - :undoc-members: - :show-inheritance: From 259b3ee84784341b50696206d559f67c74ba9c89 Mon Sep 17 00:00:00 2001 From: Thomas A Caswell Date: Wed, 11 Sep 2024 16:54:17 -0400 Subject: [PATCH 013/131] Backport PR #28798: DOC: Correctly list modules that have been internalized --- doc/api/_afm_api.rst | 8 ++++++++ doc/api/_docstring_api.rst | 8 ++++++++ doc/api/_tight_bbox_api.rst | 8 ++++++++ doc/api/_tight_layout_api.rst | 8 ++++++++ doc/api/_type1font.rst | 8 ++++++++ doc/api/afm_api.rst | 13 ------------- doc/api/docstring_api.rst | 13 ------------- doc/api/index.rst | 10 +++++----- doc/api/tight_bbox_api.rst | 13 ------------- doc/api/tight_layout_api.rst | 13 ------------- doc/api/type1font.rst | 13 ------------- 11 files changed, 45 insertions(+), 70 deletions(-) create mode 100644 doc/api/_afm_api.rst create mode 100644 doc/api/_docstring_api.rst create mode 100644 doc/api/_tight_bbox_api.rst create mode 100644 doc/api/_tight_layout_api.rst create mode 100644 doc/api/_type1font.rst delete mode 100644 doc/api/afm_api.rst delete mode 100644 doc/api/docstring_api.rst delete mode 100644 doc/api/tight_bbox_api.rst delete mode 100644 doc/api/tight_layout_api.rst delete mode 100644 doc/api/type1font.rst diff --git a/doc/api/_afm_api.rst b/doc/api/_afm_api.rst new file mode 100644 index 000000000000..4e2ac4997272 --- /dev/null +++ b/doc/api/_afm_api.rst @@ -0,0 +1,8 @@ +******************* +``matplotlib._afm`` +******************* + +.. automodule:: matplotlib._afm + :members: + :undoc-members: + :show-inheritance: diff --git a/doc/api/_docstring_api.rst b/doc/api/_docstring_api.rst new file mode 100644 index 000000000000..040a3653a87b --- /dev/null +++ b/doc/api/_docstring_api.rst @@ -0,0 +1,8 @@ +************************* +``matplotlib._docstring`` +************************* + +.. automodule:: matplotlib._docstring + :members: + :undoc-members: + :show-inheritance: diff --git a/doc/api/_tight_bbox_api.rst b/doc/api/_tight_bbox_api.rst new file mode 100644 index 000000000000..826e051fcf6d --- /dev/null +++ b/doc/api/_tight_bbox_api.rst @@ -0,0 +1,8 @@ +************************** +``matplotlib._tight_bbox`` +************************** + +.. automodule:: matplotlib._tight_bbox + :members: + :undoc-members: + :show-inheritance: diff --git a/doc/api/_tight_layout_api.rst b/doc/api/_tight_layout_api.rst new file mode 100644 index 000000000000..ac4f66f280e1 --- /dev/null +++ b/doc/api/_tight_layout_api.rst @@ -0,0 +1,8 @@ +**************************** +``matplotlib._tight_layout`` +**************************** + +.. automodule:: matplotlib._tight_layout + :members: + :undoc-members: + :show-inheritance: diff --git a/doc/api/_type1font.rst b/doc/api/_type1font.rst new file mode 100644 index 000000000000..1a9ff2292887 --- /dev/null +++ b/doc/api/_type1font.rst @@ -0,0 +1,8 @@ +************************* +``matplotlib._type1font`` +************************* + +.. automodule:: matplotlib._type1font + :members: + :undoc-members: + :show-inheritance: diff --git a/doc/api/afm_api.rst b/doc/api/afm_api.rst deleted file mode 100644 index bcae04150909..000000000000 --- a/doc/api/afm_api.rst +++ /dev/null @@ -1,13 +0,0 @@ -****************** -``matplotlib.afm`` -****************** - -.. attention:: - This module is considered internal. - - Its use is deprecated and it will be removed in a future version. - -.. automodule:: matplotlib._afm - :members: - :undoc-members: - :show-inheritance: diff --git a/doc/api/docstring_api.rst b/doc/api/docstring_api.rst deleted file mode 100644 index 38a73a2e83d1..000000000000 --- a/doc/api/docstring_api.rst +++ /dev/null @@ -1,13 +0,0 @@ -************************ -``matplotlib.docstring`` -************************ - -.. attention:: - This module is considered internal. - - Its use is deprecated and it will be removed in a future version. - -.. automodule:: matplotlib._docstring - :members: - :undoc-members: - :show-inheritance: diff --git a/doc/api/index.rst b/doc/api/index.rst index 70c3b5343e7a..53f397a6817a 100644 --- a/doc/api/index.rst +++ b/doc/api/index.rst @@ -79,7 +79,6 @@ Alphabetical list of modules: :maxdepth: 1 matplotlib_configuration_api.rst - afm_api.rst animation_api.rst artist_api.rst axes_api.rst @@ -98,7 +97,6 @@ Alphabetical list of modules: container_api.rst contour_api.rst dates_api.rst - docstring_api.rst dviread.rst figure_api.rst font_manager_api.rst @@ -134,16 +132,18 @@ Alphabetical list of modules: text_api.rst texmanager_api.rst ticker_api.rst - tight_bbox_api.rst - tight_layout_api.rst transformations.rst tri_api.rst - type1font.rst typing_api.rst units_api.rst widgets_api.rst + _afm_api.rst _api_api.rst + _docstring_api.rst _enums_api.rst + _type1font.rst + _tight_bbox_api.rst + _tight_layout_api.rst toolkits/mplot3d.rst toolkits/axes_grid1.rst toolkits/axisartist.rst diff --git a/doc/api/tight_bbox_api.rst b/doc/api/tight_bbox_api.rst deleted file mode 100644 index 9e8dd2fa66f9..000000000000 --- a/doc/api/tight_bbox_api.rst +++ /dev/null @@ -1,13 +0,0 @@ -************************* -``matplotlib.tight_bbox`` -************************* - -.. attention:: - This module is considered internal. - - Its use is deprecated and it will be removed in a future version. - -.. automodule:: matplotlib._tight_bbox - :members: - :undoc-members: - :show-inheritance: diff --git a/doc/api/tight_layout_api.rst b/doc/api/tight_layout_api.rst deleted file mode 100644 index 35f92e3ddced..000000000000 --- a/doc/api/tight_layout_api.rst +++ /dev/null @@ -1,13 +0,0 @@ -*************************** -``matplotlib.tight_layout`` -*************************** - -.. attention:: - This module is considered internal. - - Its use is deprecated and it will be removed in a future version. - -.. automodule:: matplotlib._tight_layout - :members: - :undoc-members: - :show-inheritance: diff --git a/doc/api/type1font.rst b/doc/api/type1font.rst deleted file mode 100644 index 00ef38f4d447..000000000000 --- a/doc/api/type1font.rst +++ /dev/null @@ -1,13 +0,0 @@ -************************ -``matplotlib.type1font`` -************************ - -.. attention:: - This module is considered internal. - - Its use is deprecated and it will be removed in a future version. - -.. automodule:: matplotlib._type1font - :members: - :undoc-members: - :show-inheritance: From 7b941c8a924c07215984810649ddee2a4ed51a7a Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Thu, 12 Sep 2024 05:28:44 -0400 Subject: [PATCH 014/131] Backport PR #28805: add brackets to satisfy the new sequence requirement --- galleries/examples/animation/frame_grabbing_sgskip.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/galleries/examples/animation/frame_grabbing_sgskip.py b/galleries/examples/animation/frame_grabbing_sgskip.py index 08155d2c61a7..dcc2ca01afd9 100644 --- a/galleries/examples/animation/frame_grabbing_sgskip.py +++ b/galleries/examples/animation/frame_grabbing_sgskip.py @@ -6,8 +6,6 @@ Use a MovieWriter directly to grab individual frames and write them to a file. This avoids any event loop integration, and thus works even with the Agg backend. This is not recommended for use in an interactive setting. - -Output generated via `matplotlib.animation.Animation.to_jshtml`. """ import numpy as np @@ -39,5 +37,5 @@ for i in range(100): x0 += 0.1 * np.random.randn() y0 += 0.1 * np.random.randn() - l.set_data(x0, y0) + l.set_data([x0], [y0]) writer.grab_frame() From 96654d64dfea78901c9d912aca62c47fd4fb287c Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Thu, 12 Sep 2024 05:28:44 -0400 Subject: [PATCH 015/131] Backport PR #28805: add brackets to satisfy the new sequence requirement --- galleries/examples/animation/frame_grabbing_sgskip.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/galleries/examples/animation/frame_grabbing_sgskip.py b/galleries/examples/animation/frame_grabbing_sgskip.py index 08155d2c61a7..dcc2ca01afd9 100644 --- a/galleries/examples/animation/frame_grabbing_sgskip.py +++ b/galleries/examples/animation/frame_grabbing_sgskip.py @@ -6,8 +6,6 @@ Use a MovieWriter directly to grab individual frames and write them to a file. This avoids any event loop integration, and thus works even with the Agg backend. This is not recommended for use in an interactive setting. - -Output generated via `matplotlib.animation.Animation.to_jshtml`. """ import numpy as np @@ -39,5 +37,5 @@ for i in range(100): x0 += 0.1 * np.random.randn() y0 += 0.1 * np.random.randn() - l.set_data(x0, y0) + l.set_data([x0], [y0]) writer.grab_frame() From 5fa2a000e4700294a059212dc3e0847e0db5ea01 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Thu, 12 Sep 2024 19:05:23 -0400 Subject: [PATCH 016/131] Backport PR #28810: Document how to obtain sans-serif usetex math. --- galleries/users_explain/text/usetex.py | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/galleries/users_explain/text/usetex.py b/galleries/users_explain/text/usetex.py index 0194a0030d48..f0c266819897 100644 --- a/galleries/users_explain/text/usetex.py +++ b/galleries/users_explain/text/usetex.py @@ -102,6 +102,12 @@ :rc:`text.usetex`. As noted above, underscores (``_``) do not require escaping outside of math mode. +.. note:: + LaTeX always defaults to using a serif font for math (even when + ``rcParams["font.family"] = "sans-serif"``). If desired, adding + ``\usepackage{sfmath}`` to ``rcParams["text.latex.preamble"]`` lets LaTeX + output sans-serif math. + PostScript options ================== @@ -129,19 +135,13 @@ :ref:`setting-windows-environment-variables` for details. * Using MiKTeX with Computer Modern fonts, if you get odd \*Agg and PNG - results, go to MiKTeX/Options and update your format files + results, go to MiKTeX/Options and update your format files. * On Ubuntu and Gentoo, the base texlive install does not ship with the type1cm package. You may need to install some of the extra packages to get all the goodies that come bundled with other LaTeX distributions. -* Some progress has been made so Matplotlib uses the dvi files - directly for text layout. This allows LaTeX to be used for text - layout with the pdf and svg backends, as well as the \*Agg and PS - backends. In the future, a LaTeX installation may be the only - external dependency. - .. _usetex-troubleshooting: Troubleshooting @@ -150,7 +150,7 @@ * Try deleting your :file:`.matplotlib/tex.cache` directory. If you don't know where to find :file:`.matplotlib`, see :ref:`locating-matplotlib-config-dir`. -* Make sure LaTeX, dvipng and ghostscript are each working and on your +* Make sure LaTeX, dvipng and Ghostscript are each working and on your :envvar:`PATH`. * Make sure what you are trying to do is possible in a LaTeX document, @@ -159,8 +159,7 @@ * :rc:`text.latex.preamble` is not officially supported. This option provides lots of flexibility, and lots of ways to cause - problems. Please disable this option before reporting problems to - the mailing list. + problems. Please disable this option before reporting problems. * If you still need help, please see :ref:`reporting-problems`. From a058fae22f55154bd4080b41a5d9b096e8e96d1d Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Thu, 12 Sep 2024 19:05:23 -0400 Subject: [PATCH 017/131] Backport PR #28810: Document how to obtain sans-serif usetex math. --- galleries/users_explain/text/usetex.py | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/galleries/users_explain/text/usetex.py b/galleries/users_explain/text/usetex.py index 0194a0030d48..f0c266819897 100644 --- a/galleries/users_explain/text/usetex.py +++ b/galleries/users_explain/text/usetex.py @@ -102,6 +102,12 @@ :rc:`text.usetex`. As noted above, underscores (``_``) do not require escaping outside of math mode. +.. note:: + LaTeX always defaults to using a serif font for math (even when + ``rcParams["font.family"] = "sans-serif"``). If desired, adding + ``\usepackage{sfmath}`` to ``rcParams["text.latex.preamble"]`` lets LaTeX + output sans-serif math. + PostScript options ================== @@ -129,19 +135,13 @@ :ref:`setting-windows-environment-variables` for details. * Using MiKTeX with Computer Modern fonts, if you get odd \*Agg and PNG - results, go to MiKTeX/Options and update your format files + results, go to MiKTeX/Options and update your format files. * On Ubuntu and Gentoo, the base texlive install does not ship with the type1cm package. You may need to install some of the extra packages to get all the goodies that come bundled with other LaTeX distributions. -* Some progress has been made so Matplotlib uses the dvi files - directly for text layout. This allows LaTeX to be used for text - layout with the pdf and svg backends, as well as the \*Agg and PS - backends. In the future, a LaTeX installation may be the only - external dependency. - .. _usetex-troubleshooting: Troubleshooting @@ -150,7 +150,7 @@ * Try deleting your :file:`.matplotlib/tex.cache` directory. If you don't know where to find :file:`.matplotlib`, see :ref:`locating-matplotlib-config-dir`. -* Make sure LaTeX, dvipng and ghostscript are each working and on your +* Make sure LaTeX, dvipng and Ghostscript are each working and on your :envvar:`PATH`. * Make sure what you are trying to do is possible in a LaTeX document, @@ -159,8 +159,7 @@ * :rc:`text.latex.preamble` is not officially supported. This option provides lots of flexibility, and lots of ways to cause - problems. Please disable this option before reporting problems to - the mailing list. + problems. Please disable this option before reporting problems. * If you still need help, please see :ref:`reporting-problems`. From 791d6c02c6a43b91ea2953910e6d20b9adffa612 Mon Sep 17 00:00:00 2001 From: Thomas A Caswell Date: Mon, 16 Sep 2024 14:39:29 -0400 Subject: [PATCH 018/131] Backport PR #28818: Resolve configdir so that it's not a symlink when is_dir() is called --- lib/matplotlib/__init__.py | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/lib/matplotlib/__init__.py b/lib/matplotlib/__init__.py index 9e9325a27d73..ad4676b11ae0 100644 --- a/lib/matplotlib/__init__.py +++ b/lib/matplotlib/__init__.py @@ -518,35 +518,38 @@ def _get_xdg_cache_dir(): def _get_config_or_cache_dir(xdg_base_getter): configdir = os.environ.get('MPLCONFIGDIR') if configdir: - configdir = Path(configdir).resolve() + configdir = Path(configdir) elif sys.platform.startswith(('linux', 'freebsd')): # Only call _xdg_base_getter here so that MPLCONFIGDIR is tried first, # as _xdg_base_getter can throw. configdir = Path(xdg_base_getter(), "matplotlib") else: configdir = Path.home() / ".matplotlib" + # Resolve the path to handle potential issues with inaccessible symlinks. + configdir = configdir.resolve() try: configdir.mkdir(parents=True, exist_ok=True) - except OSError: - pass + except OSError as exc: + _log.warning("mkdir -p failed for path %s: %s", configdir, exc) else: if os.access(str(configdir), os.W_OK) and configdir.is_dir(): return str(configdir) + _log.warning("%s is not a writable directory", configdir) # If the config or cache directory cannot be created or is not a writable # directory, create a temporary one. try: tmpdir = tempfile.mkdtemp(prefix="matplotlib-") except OSError as exc: raise OSError( - f"Matplotlib requires access to a writable cache directory, but the " - f"default path ({configdir}) is not a writable directory, and a temporary " + f"Matplotlib requires access to a writable cache directory, but there " + f"was an issue with the default path ({configdir}), and a temporary " f"directory could not be created; set the MPLCONFIGDIR environment " f"variable to a writable directory") from exc os.environ["MPLCONFIGDIR"] = tmpdir atexit.register(shutil.rmtree, tmpdir) _log.warning( - "Matplotlib created a temporary cache directory at %s because the default path " - "(%s) is not a writable directory; it is highly recommended to set the " + "Matplotlib created a temporary cache directory at %s because there was " + "an issue with the default path (%s); it is highly recommended to set the " "MPLCONFIGDIR environment variable to a writable directory, in particular to " "speed up the import of Matplotlib and to better support multiprocessing.", tmpdir, configdir) From ae85b62e623baffa6679f9f3a58384ba0e1e5947 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Wed, 18 Sep 2024 22:36:21 -0400 Subject: [PATCH 019/131] Backport PR #28836: MNT: Use __init__ parameters of font properties --- .../text_labels_and_annotations/fonts_demo.py | 17 +++++------------ galleries/users_explain/text/text_intro.py | 5 +---- 2 files changed, 6 insertions(+), 16 deletions(-) diff --git a/galleries/examples/text_labels_and_annotations/fonts_demo.py b/galleries/examples/text_labels_and_annotations/fonts_demo.py index bc36c10bce8b..821ee278c4ba 100644 --- a/galleries/examples/text_labels_and_annotations/fonts_demo.py +++ b/galleries/examples/text_labels_and_annotations/fonts_demo.py @@ -21,34 +21,28 @@ fig.text(0.1, 0.9, 'family', fontproperties=heading_font, **alignment) families = ['serif', 'sans-serif', 'cursive', 'fantasy', 'monospace'] for k, family in enumerate(families): - font = FontProperties() - font.set_family(family) + font = FontProperties(family=[family]) fig.text(0.1, yp[k], family, fontproperties=font, **alignment) # Show style options styles = ['normal', 'italic', 'oblique'] fig.text(0.3, 0.9, 'style', fontproperties=heading_font, **alignment) for k, style in enumerate(styles): - font = FontProperties() - font.set_family('sans-serif') - font.set_style(style) + font = FontProperties(family='sans-serif', style=style) fig.text(0.3, yp[k], style, fontproperties=font, **alignment) # Show variant options variants = ['normal', 'small-caps'] fig.text(0.5, 0.9, 'variant', fontproperties=heading_font, **alignment) for k, variant in enumerate(variants): - font = FontProperties() - font.set_family('serif') - font.set_variant(variant) + font = FontProperties(family='serif', variant=variant) fig.text(0.5, yp[k], variant, fontproperties=font, **alignment) # Show weight options weights = ['light', 'normal', 'medium', 'semibold', 'bold', 'heavy', 'black'] fig.text(0.7, 0.9, 'weight', fontproperties=heading_font, **alignment) for k, weight in enumerate(weights): - font = FontProperties() - font.set_weight(weight) + font = FontProperties(weight=weight) fig.text(0.7, yp[k], weight, fontproperties=font, **alignment) # Show size options @@ -56,8 +50,7 @@ 'xx-small', 'x-small', 'small', 'medium', 'large', 'x-large', 'xx-large'] fig.text(0.9, 0.9, 'size', fontproperties=heading_font, **alignment) for k, size in enumerate(sizes): - font = FontProperties() - font.set_size(size) + font = FontProperties(size=size) fig.text(0.9, yp[k], size, fontproperties=font, **alignment) # Show bold italic diff --git a/galleries/users_explain/text/text_intro.py b/galleries/users_explain/text/text_intro.py index 948545667fa9..3b8a66f1c98e 100644 --- a/galleries/users_explain/text/text_intro.py +++ b/galleries/users_explain/text/text_intro.py @@ -177,10 +177,7 @@ from matplotlib.font_manager import FontProperties -font = FontProperties() -font.set_family('serif') -font.set_name('Times New Roman') -font.set_style('italic') +font = FontProperties(family='Times New Roman', style='italic') fig, ax = plt.subplots(figsize=(5, 3)) fig.subplots_adjust(bottom=0.15, left=0.2) From 172624ebcbdccb08b27fb137910a2253871801e1 Mon Sep 17 00:00:00 2001 From: Ruth Comer <10599679+rcomer@users.noreply.github.com> Date: Sat, 21 Sep 2024 08:31:41 +0100 Subject: [PATCH 020/131] Backport PR #28858: Fix flaky labelcolor tests --- lib/matplotlib/tests/test_legend.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/matplotlib/tests/test_legend.py b/lib/matplotlib/tests/test_legend.py index 0353f1408b73..3c2af275649f 100644 --- a/lib/matplotlib/tests/test_legend.py +++ b/lib/matplotlib/tests/test_legend.py @@ -868,8 +868,8 @@ def test_legend_pathcollection_labelcolor_linecolor_iterable(): # test the labelcolor for labelcolor='linecolor' on PathCollection # with iterable colors fig, ax = plt.subplots() - colors = np.random.default_rng().choice(['r', 'g', 'b'], 10) - ax.scatter(np.arange(10), np.arange(10)*1, label='#1', c=colors) + colors = np.array(['r', 'g', 'b', 'c', 'm'] * 2) + ax.scatter(np.arange(10), np.arange(10), label='#1', c=colors) leg = ax.legend(labelcolor='linecolor') text, = leg.get_texts() @@ -915,8 +915,8 @@ def test_legend_pathcollection_labelcolor_markeredgecolor_iterable(): # test the labelcolor for labelcolor='markeredgecolor' on PathCollection # with iterable colors fig, ax = plt.subplots() - colors = np.random.default_rng().choice(['r', 'g', 'b'], 10) - ax.scatter(np.arange(10), np.arange(10)*1, label='#1', edgecolor=colors) + colors = np.array(['r', 'g', 'b', 'c', 'm'] * 2) + ax.scatter(np.arange(10), np.arange(10), label='#1', edgecolor=colors) leg = ax.legend(labelcolor='markeredgecolor') for text, color in zip(leg.get_texts(), ['k']): @@ -970,8 +970,8 @@ def test_legend_pathcollection_labelcolor_markerfacecolor_iterable(): # test the labelcolor for labelcolor='markerfacecolor' on PathCollection # with iterable colors fig, ax = plt.subplots() - colors = np.random.default_rng().choice(['r', 'g', 'b'], 10) - ax.scatter(np.arange(10), np.arange(10)*1, label='#1', facecolor=colors) + colors = np.array(['r', 'g', 'b', 'c', 'm'] * 2) + ax.scatter(np.arange(10), np.arange(10), label='#1', facecolor=colors) leg = ax.legend(labelcolor='markerfacecolor') for text, color in zip(leg.get_texts(), ['k']): From ff3e448f0d7183d04c4e353fcb19948e88e5d31f Mon Sep 17 00:00:00 2001 From: Tim Hoffmann <2836374+timhoffm@users.noreply.github.com> Date: Wed, 25 Sep 2024 21:44:15 +0200 Subject: [PATCH 021/131] Backport PR #28883: Only check X11 when running Tkinter tests --- lib/matplotlib/_c_internal_utils.pyi | 1 + lib/matplotlib/cbook.py | 2 +- lib/matplotlib/tests/test_backend_tk.py | 4 +-- .../tests/test_backends_interactive.py | 10 +++++--- lib/matplotlib/tests/test_rcparams.py | 2 +- src/_c_internal_utils.cpp | 25 ++++++++++++++++++- 6 files changed, 36 insertions(+), 8 deletions(-) diff --git a/lib/matplotlib/_c_internal_utils.pyi b/lib/matplotlib/_c_internal_utils.pyi index 3efc81bc8332..ccc172cde27a 100644 --- a/lib/matplotlib/_c_internal_utils.pyi +++ b/lib/matplotlib/_c_internal_utils.pyi @@ -1,4 +1,5 @@ def display_is_valid() -> bool: ... +def xdisplay_is_valid() -> bool: ... def Win32_GetForegroundWindow() -> int | None: ... def Win32_SetForegroundWindow(hwnd: int) -> None: ... diff --git a/lib/matplotlib/cbook.py b/lib/matplotlib/cbook.py index f5a4199cf9ad..c5b851ff6c9b 100644 --- a/lib/matplotlib/cbook.py +++ b/lib/matplotlib/cbook.py @@ -72,7 +72,7 @@ def _get_running_interactive_framework(): if frame.f_code in codes: return "tk" frame = frame.f_back - # premetively break reference cycle between locals and the frame + # Preemptively break reference cycle between locals and the frame. del frame macosx = sys.modules.get("matplotlib.backends._macosx") if macosx and macosx.event_loop_is_running(): diff --git a/lib/matplotlib/tests/test_backend_tk.py b/lib/matplotlib/tests/test_backend_tk.py index ee20a94042f7..89782e8a66f3 100644 --- a/lib/matplotlib/tests/test_backend_tk.py +++ b/lib/matplotlib/tests/test_backend_tk.py @@ -35,8 +35,8 @@ def _isolated_tk_test(success_count, func=None): reason="missing tkinter" ) @pytest.mark.skipif( - sys.platform == "linux" and not _c_internal_utils.display_is_valid(), - reason="$DISPLAY and $WAYLAND_DISPLAY are unset" + sys.platform == "linux" and not _c_internal_utils.xdisplay_is_valid(), + reason="$DISPLAY is unset" ) @pytest.mark.xfail( # https://github.com/actions/setup-python/issues/649 ('TF_BUILD' in os.environ or 'GITHUB_ACTION' in os.environ) and diff --git a/lib/matplotlib/tests/test_backends_interactive.py b/lib/matplotlib/tests/test_backends_interactive.py index 2c6b61a48438..ca702bc1d99c 100644 --- a/lib/matplotlib/tests/test_backends_interactive.py +++ b/lib/matplotlib/tests/test_backends_interactive.py @@ -57,6 +57,8 @@ def wait_for(self, terminator): def _get_available_interactive_backends(): _is_linux_and_display_invalid = (sys.platform == "linux" and not _c_internal_utils.display_is_valid()) + _is_linux_and_xdisplay_invalid = (sys.platform == "linux" and + not _c_internal_utils.xdisplay_is_valid()) envs = [] for deps, env in [ *[([qt_api], @@ -74,10 +76,12 @@ def _get_available_interactive_backends(): ]: reason = None missing = [dep for dep in deps if not importlib.util.find_spec(dep)] - if _is_linux_and_display_invalid: - reason = "$DISPLAY and $WAYLAND_DISPLAY are unset" - elif missing: + if missing: reason = "{} cannot be imported".format(", ".join(missing)) + elif env["MPLBACKEND"] == "tkagg" and _is_linux_and_xdisplay_invalid: + reason = "$DISPLAY is unset" + elif _is_linux_and_display_invalid: + reason = "$DISPLAY and $WAYLAND_DISPLAY are unset" elif env["MPLBACKEND"] == 'macosx' and os.environ.get('TF_BUILD'): reason = "macosx backend fails on Azure" elif env["MPLBACKEND"].startswith('gtk'): diff --git a/lib/matplotlib/tests/test_rcparams.py b/lib/matplotlib/tests/test_rcparams.py index 4823df0ce250..25ae258ffcbb 100644 --- a/lib/matplotlib/tests/test_rcparams.py +++ b/lib/matplotlib/tests/test_rcparams.py @@ -536,7 +536,7 @@ def test_backend_fallback_headless(tmp_path): @pytest.mark.skipif( - sys.platform == "linux" and not _c_internal_utils.display_is_valid(), + sys.platform == "linux" and not _c_internal_utils.xdisplay_is_valid(), reason="headless") def test_backend_fallback_headful(tmp_path): pytest.importorskip("tkinter") diff --git a/src/_c_internal_utils.cpp b/src/_c_internal_utils.cpp index 74bb97904f89..561cb303639c 100644 --- a/src/_c_internal_utils.cpp +++ b/src/_c_internal_utils.cpp @@ -33,7 +33,7 @@ namespace py = pybind11; using namespace pybind11::literals; static bool -mpl_display_is_valid(void) +mpl_xdisplay_is_valid(void) { #ifdef __linux__ void* libX11; @@ -57,6 +57,19 @@ mpl_display_is_valid(void) return true; } } + return false; +#else + return true; +#endif +} + +static bool +mpl_display_is_valid(void) +{ +#ifdef __linux__ + if (mpl_xdisplay_is_valid()) { + return true; + } void* libwayland_client; if (getenv("WAYLAND_DISPLAY") && (libwayland_client = dlopen("libwayland-client.so.0", RTLD_LAZY))) { @@ -194,6 +207,16 @@ PYBIND11_MODULE(_c_internal_utils, m) succeeds, or $WAYLAND_DISPLAY is set and wl_display_connect(NULL) succeeds. + On other platforms, always returns True.)"""); + m.def( + "xdisplay_is_valid", &mpl_xdisplay_is_valid, + R"""( -- + Check whether the current X11 display is valid. + + On Linux, returns True if either $DISPLAY is set and XOpenDisplay(NULL) + succeeds. Use this function if you need to specifically check for X11 + only (e.g., for Tkinter). + On other platforms, always returns True.)"""); m.def( "Win32_GetCurrentProcessExplicitAppUserModelID", From 00f63b745f453f5e736b62d978df95ac9ee68f6b Mon Sep 17 00:00:00 2001 From: Kyra Cho Date: Fri, 27 Sep 2024 16:55:12 -0700 Subject: [PATCH 022/131] Backport PR #28881: Fix `axline` for slopes <= 1E-8. Closes #28386 --- lib/matplotlib/lines.py | 2 +- lib/matplotlib/tests/test_lines.py | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/lib/matplotlib/lines.py b/lib/matplotlib/lines.py index 72e74f4eb9c5..569669f76e8d 100644 --- a/lib/matplotlib/lines.py +++ b/lib/matplotlib/lines.py @@ -1520,7 +1520,7 @@ def get_transform(self): (vxlo, vylo), (vxhi, vyhi) = ax.transScale.transform(ax.viewLim) # General case: find intersections with view limits in either # direction, and draw between the middle two points. - if np.isclose(slope, 0): + if slope == 0: start = vxlo, y1 stop = vxhi, y1 elif np.isinf(slope): diff --git a/lib/matplotlib/tests/test_lines.py b/lib/matplotlib/tests/test_lines.py index 531237b2ba28..902b7aa2c02d 100644 --- a/lib/matplotlib/tests/test_lines.py +++ b/lib/matplotlib/tests/test_lines.py @@ -436,3 +436,14 @@ def test_axline_setters(): with pytest.raises(ValueError, match="Cannot set a 'slope' value while 'xy2' is set"): line2.set_slope(3) + + +def test_axline_small_slope(): + """Test that small slopes are not coerced to zero in the transform.""" + line = plt.axline((0, 0), slope=1e-14) + p1 = line.get_transform().transform_point((0, 0)) + p2 = line.get_transform().transform_point((1, 1)) + # y-values must be slightly different + dy = p2[1] - p1[1] + assert dy > 0 + assert dy < 4e-12 From ab09fcc97c9ad791ba41dcfdd4276f634585263a Mon Sep 17 00:00:00 2001 From: Tim Hoffmann <2836374+timhoffm@users.noreply.github.com> Date: Thu, 15 Aug 2024 13:36:36 +0200 Subject: [PATCH 023/131] Backport PR #28689: ci: Enable testing on Python 3.13 --- .github/workflows/tests.yml | 54 +++++++++++++++++-- lib/matplotlib/tests/test_axes.py | 4 +- lib/matplotlib/tests/test_contour.py | 2 +- lib/mpl_toolkits/mplot3d/tests/test_axes3d.py | 2 +- 4 files changed, 54 insertions(+), 8 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 634c83fa57fd..cd4c08e29fb9 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -88,14 +88,31 @@ jobs: pyqt6-ver: '!=6.6.0' # https://bugreports.qt.io/projects/PYSIDE/issues/PYSIDE-2346 pyside6-ver: '!=6.5.1' - - os: macos-12 # This runnre is on Intel chips. - python-version: 3.9 + - os: ubuntu-22.04 + python-version: '3.13' + # https://www.riverbankcomputing.com/pipermail/pyqt/2023-November/045606.html + pyqt6-ver: '!=6.6.0' + # https://bugreports.qt.io/projects/PYSIDE/issues/PYSIDE-2346 + pyside6-ver: '!=6.5.1' + - name-suffix: "Free-threaded" + os: ubuntu-22.04 + python-version: '3.13t' + # https://www.riverbankcomputing.com/pipermail/pyqt/2023-November/045606.html + pyqt6-ver: '!=6.6.0' + # https://bugreports.qt.io/projects/PYSIDE/issues/PYSIDE-2346 + pyside6-ver: '!=6.5.1' + - os: macos-12 # This runner is on Intel chips. + python-version: '3.9' # https://bugreports.qt.io/projects/PYSIDE/issues/PYSIDE-2346 pyside6-ver: '!=6.5.1' - os: macos-14 # This runner is on M1 (arm64) chips. python-version: '3.12' # https://bugreports.qt.io/projects/PYSIDE/issues/PYSIDE-2346 pyside6-ver: '!=6.5.1' + - os: macos-14 # This runner is on M1 (arm64) chips. + python-version: '3.13' + # https://bugreports.qt.io/projects/PYSIDE/issues/PYSIDE-2346 + pyside6-ver: '!=6.5.1' steps: - uses: actions/checkout@v4 @@ -104,8 +121,17 @@ jobs: - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v5 + if: matrix.python-version != '3.13t' with: python-version: ${{ matrix.python-version }} + allow-prereleases: true + + - name: Set up Python ${{ matrix.python-version }} + uses: deadsnakes/action@6c8b9b82fe0b4344f4b98f2775fcc395df45e494 # v3.1.0 + if: matrix.python-version == '3.13t' + with: + python-version: '3.13' + nogil: true - name: Install OS dependencies run: | @@ -152,6 +178,11 @@ jobs: texlive-luatex \ texlive-pictures \ texlive-xetex + if [[ "${{ matrix.python-version }}" = '3.13t' ]]; then + # TODO: Remove this once setup-python supports nogil distributions. + sudo apt-get install -yy --no-install-recommends \ + python3.13-tk-nogil + fi if [[ "${{ matrix.os }}" = ubuntu-20.04 ]]; then sudo apt-get install -yy --no-install-recommends libopengl0 else # ubuntu-22.04 @@ -202,6 +233,15 @@ jobs: 4-${{ runner.os }}-py${{ matrix.python-version }}-mpl-${{ github.ref }}- 4-${{ runner.os }}-py${{ matrix.python-version }}-mpl- + - name: Install the nightly dependencies + if: matrix.python-version == '3.13t' + run: | + python -m pip install pytz tzdata python-dateutil # Must be installed for Pandas. + python -m pip install \ + --pre \ + --index-url https://pypi.anaconda.org/scientific-python-nightly-wheels/simple \ + --upgrade --only-binary=:all: numpy pandas pillow contourpy + - name: Install Python dependencies run: | # Upgrade pip and setuptools and wheel to get as clean an install as @@ -227,6 +267,7 @@ jobs: # Sphinx is needed to run sphinxext tests python -m pip install --upgrade sphinx!=6.1.2 + if [[ "${{ matrix.python-version }}" != '3.13t' ]]; then # GUI toolkits are pip-installable only for some versions of Python # so don't fail if we can't install them. Make it easier to check # whether the install was successful by trying to import the toolkit @@ -246,11 +287,11 @@ jobs: python -c 'import PyQt5.QtCore' && echo 'PyQt5 is available' || echo 'PyQt5 is not available' - # Even though PySide2 wheels can be installed on Python 3.12, they are broken and since PySide2 is + # Even though PySide2 wheels can be installed on Python 3.12+, they are broken and since PySide2 is # deprecated, they are unlikely to be fixed. For the same deprecation reason, there are no wheels # on M1 macOS, so don't bother there either. if [[ "${{ matrix.os }}" != 'macos-14' - && "${{ matrix.python-version }}" != '3.12' ]]; then + && "${{ matrix.python-version }}" != '3.12' && "${{ matrix.python-version }}" != '3.13' ]]; then python -mpip install --upgrade pyside2${{ matrix.pyside2-ver }} && python -c 'import PySide2.QtCore' && echo 'PySide2 is available' || @@ -272,6 +313,8 @@ jobs: echo 'wxPython is available' || echo 'wxPython is not available' + fi # Skip backends on Python 3.13t. + - name: Install the nightly dependencies # Only install the nightly dependencies during the scheduled event if: github.event_name == 'schedule' && matrix.name-suffix != '(Minimum Versions)' @@ -310,6 +353,9 @@ jobs: - name: Run pytest run: | + if [[ "${{ matrix.python-version }}" == '3.13t' ]]; then + export PYTHON_GIL=0 + fi pytest -rfEsXR -n auto \ --maxfail=50 --timeout=300 --durations=25 \ --cov-report=xml --cov=lib --log-level=DEBUG --color=yes diff --git a/lib/matplotlib/tests/test_axes.py b/lib/matplotlib/tests/test_axes.py index 3ec9923c0840..e99ef129eb9a 100644 --- a/lib/matplotlib/tests/test_axes.py +++ b/lib/matplotlib/tests/test_axes.py @@ -1186,7 +1186,7 @@ def test_imshow(): @image_comparison( ['imshow_clip'], style='mpl20', - tol=1.24 if platform.machine() in ('aarch64', 'ppc64le', 's390x') else 0) + tol=1.24 if platform.machine() in ('aarch64', 'arm64', 'ppc64le', 's390x') else 0) def test_imshow_clip(): # As originally reported by Gellule Xg # use former defaults to match existing baseline image @@ -2570,7 +2570,7 @@ def test_contour_hatching(): @image_comparison( ['contour_colorbar'], style='mpl20', - tol=0.54 if platform.machine() in ('aarch64', 'ppc64le', 's390x') else 0) + tol=0.54 if platform.machine() in ('aarch64', 'arm64', 'ppc64le', 's390x') else 0) def test_contour_colorbar(): x, y, z = contour_dat() diff --git a/lib/matplotlib/tests/test_contour.py b/lib/matplotlib/tests/test_contour.py index d4600a14fe1c..0622c099a20c 100644 --- a/lib/matplotlib/tests/test_contour.py +++ b/lib/matplotlib/tests/test_contour.py @@ -442,7 +442,7 @@ def test_contourf_log_extension(split_collections): @pytest.mark.parametrize("split_collections", [False, True]) @image_comparison( ['contour_addlines.png'], remove_text=True, style='mpl20', - tol=0.15 if platform.machine() in ('aarch64', 'ppc64le', 's390x') + tol=0.15 if platform.machine() in ('aarch64', 'arm64', 'ppc64le', 's390x') else 0.03) # tolerance is because image changed minutely when tick finding on # colorbars was cleaned up... diff --git a/lib/mpl_toolkits/mplot3d/tests/test_axes3d.py b/lib/mpl_toolkits/mplot3d/tests/test_axes3d.py index ecb51b724c27..ff5ab230ef06 100644 --- a/lib/mpl_toolkits/mplot3d/tests/test_axes3d.py +++ b/lib/mpl_toolkits/mplot3d/tests/test_axes3d.py @@ -221,7 +221,7 @@ def test_bar3d_lightsource(): @mpl3d_image_comparison( ['contour3d.png'], style='mpl20', - tol=0.002 if platform.machine() in ('aarch64', 'ppc64le', 's390x') else 0) + tol=0.002 if platform.machine() in ('aarch64', 'arm64', 'ppc64le', 's390x') else 0) def test_contour3d(): plt.rcParams['axes3d.automargin'] = True # Remove when image is regenerated fig = plt.figure() From fad3579287324c16daeb8719af68ccb58fe1b94b Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Fri, 4 Oct 2024 05:02:26 -0400 Subject: [PATCH 024/131] Backport PR #28900: DOC: Improve fancybox demo --- .../shapes_and_collections/fancybox_demo.py | 84 ++++++++++++++----- 1 file changed, 63 insertions(+), 21 deletions(-) diff --git a/galleries/examples/shapes_and_collections/fancybox_demo.py b/galleries/examples/shapes_and_collections/fancybox_demo.py index 91cc1d1749ea..8d36a5a14d9d 100644 --- a/galleries/examples/shapes_and_collections/fancybox_demo.py +++ b/galleries/examples/shapes_and_collections/fancybox_demo.py @@ -3,7 +3,8 @@ Drawing fancy boxes =================== -The following examples show how to plot boxes with different visual properties. +The following examples show how to plot boxes (`.FancyBboxPatch`) with different +visual properties. """ import inspect @@ -15,7 +16,12 @@ import matplotlib.transforms as mtransforms # %% -# First we'll show some sample boxes with fancybox. +# Box styles +# ---------- +# `.FancyBboxPatch` supports different `.BoxStyle`\s. Note that `~.Axes.text` +# allows to draw a box around the text by adding the ``bbox`` parameter. Therefore, +# you don't see explicit `.FancyBboxPatch` and `.BoxStyle` calls in the following +# example. styles = mpatch.BoxStyle.get_styles() ncol = 2 @@ -41,13 +47,21 @@ # %% -# Next we'll show off multiple fancy boxes at once. - +# Parameters for modifying the box +# -------------------------------- +# `.BoxStyle`\s have additional parameters to configure their appearance. +# For example, "round" boxes can have ``pad`` and ``rounding``. +# +# Additionally, the `.FancyBboxPatch` parameters ``mutation_scale`` and +# ``mutation_aspect`` scale the box appearance. def add_fancy_patch_around(ax, bb, **kwargs): - fancy = FancyBboxPatch(bb.p0, bb.width, bb.height, - fc=(1, 0.8, 1, 0.5), ec=(1, 0.5, 1, 0.5), - **kwargs) + kwargs = { + 'facecolor': (1, 0.8, 1, 0.5), + 'edgecolor': (1, 0.5, 1, 0.5), + **kwargs + } + fancy = FancyBboxPatch(bb.p0, bb.width, bb.height, **kwargs) ax.add_patch(fancy) return fancy @@ -65,7 +79,7 @@ def draw_control_points_for_patches(ax): ax = axs[0, 0] # a fancy box with round corners. pad=0.1 -fancy = add_fancy_patch_around(ax, bb, boxstyle="round,pad=0.1") +add_fancy_patch_around(ax, bb, boxstyle="round,pad=0.1") ax.set(xlim=(0, 1), ylim=(0, 1), aspect=1, title='boxstyle="round,pad=0.1"') @@ -84,33 +98,61 @@ def draw_control_points_for_patches(ax): ax = axs[1, 0] # mutation_scale determines the overall scale of the mutation, i.e. both pad # and rounding_size is scaled according to this value. -fancy = add_fancy_patch_around( - ax, bb, boxstyle="round,pad=0.1", mutation_scale=2) +add_fancy_patch_around(ax, bb, boxstyle="round,pad=0.1", mutation_scale=2) ax.set(xlim=(0, 1), ylim=(0, 1), aspect=1, title='boxstyle="round,pad=0.1"\n mutation_scale=2') ax = axs[1, 1] -# When the aspect ratio of the Axes is not 1, the fancy box may not be what you -# expected (green). -fancy = add_fancy_patch_around(ax, bb, boxstyle="round,pad=0.2") -fancy.set(facecolor="none", edgecolor="green") -# You can compensate this by setting the mutation_aspect (pink). -fancy = add_fancy_patch_around( - ax, bb, boxstyle="round,pad=0.3", mutation_aspect=0.5) -ax.set(xlim=(-.5, 1.5), ylim=(0, 1), aspect=2, - title='boxstyle="round,pad=0.3"\nmutation_aspect=.5') +# mutation_aspect scales the vertical influence of the parameters (technically, +# it scales the height of the box down by mutation_aspect, applies the box parameters +# and scales the result back up). In effect, the vertical pad is scaled to +# pad * mutation_aspect, e.g. mutation_aspect=0.5 halves the vertical pad. +add_fancy_patch_around(ax, bb, boxstyle="round,pad=0.1", mutation_aspect=0.5) +ax.set(xlim=(0, 1), ylim=(0, 1), + title='boxstyle="round,pad=0.1"\nmutation_aspect=0.5') for ax in axs.flat: draw_control_points_for_patches(ax) # Draw the original bbox (using boxstyle=square with pad=0). - fancy = add_fancy_patch_around(ax, bb, boxstyle="square,pad=0") - fancy.set(edgecolor="black", facecolor="none", zorder=10) + add_fancy_patch_around(ax, bb, boxstyle="square,pad=0", + edgecolor="black", facecolor="none", zorder=10) fig.tight_layout() plt.show() +# %% +# Creating visually constant padding on non-equal aspect Axes +# ----------------------------------------------------------- +# Since padding is in box coordinates, i.e. usually data coordinates, +# a given padding is rendered to different visual sizes if the +# Axes aspect is not 1. +# To get visually equal vertical and horizontal padding, set the +# mutation_aspect to the inverse of the Axes aspect. This scales +# the vertical padding appropriately. + +fig, (ax1, ax2) = plt.subplots(1, 2, figsize=(6.5, 5)) + +# original boxes +bb = mtransforms.Bbox([[-0.5, -0.5], [0.5, 0.5]]) +add_fancy_patch_around(ax1, bb, boxstyle="square,pad=0", + edgecolor="black", facecolor="none", zorder=10) +add_fancy_patch_around(ax2, bb, boxstyle="square,pad=0", + edgecolor="black", facecolor="none", zorder=10) +ax1.set(xlim=(-1.5, 1.5), ylim=(-1.5, 1.5), aspect=2) +ax2.set(xlim=(-1.5, 1.5), ylim=(-1.5, 1.5), aspect=2) + + +fancy = add_fancy_patch_around( + ax1, bb, boxstyle="round,pad=0.5") +ax1.set_title("aspect=2\nmutation_aspect=1") + +fancy = add_fancy_patch_around( + ax2, bb, boxstyle="round,pad=0.5", mutation_aspect=0.5) +ax2.set_title("aspect=2\nmutation_aspect=0.5") + + # %% # # .. admonition:: References From 97ea6ef94d0e67271fda0853b55aaf8c077ae4df Mon Sep 17 00:00:00 2001 From: "Lumberbot (aka Jack)" <39504233+meeseeksmachine@users.noreply.github.com> Date: Wed, 9 Oct 2024 12:07:04 -0700 Subject: [PATCH 025/131] Backport PR #28952: BLD: update trove metadata to support py3.13 (#28954) Co-authored-by: Greg Lucas --- pyproject.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/pyproject.toml b/pyproject.toml index 891ef87e4342..c0237c7df5c5 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -20,6 +20,7 @@ classifiers=[ "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", + "Programming Language :: Python :: 3.13", "Topic :: Scientific/Engineering :: Visualization", ] From 7fd3b7ba4aae22d6defd14d1cbb69e562d7f4522 Mon Sep 17 00:00:00 2001 From: Tim Hoffmann <2836374+timhoffm@users.noreply.github.com> Date: Thu, 17 Oct 2024 21:04:14 +0200 Subject: [PATCH 026/131] Backport PR #28987: Fix: Do not use numeric tolerances for axline special cases --- lib/matplotlib/lines.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/matplotlib/lines.py b/lib/matplotlib/lines.py index 569669f76e8d..d24e528e4c0a 100644 --- a/lib/matplotlib/lines.py +++ b/lib/matplotlib/lines.py @@ -1505,8 +1505,8 @@ def get_transform(self): points_transform.transform([self._xy1, self._xy2]) dx = x2 - x1 dy = y2 - y1 - if np.allclose(x1, x2): - if np.allclose(y1, y2): + if dx == 0: + if dy == 0: raise ValueError( f"Cannot draw a line through two identical points " f"(x={(x1, x2)}, y={(y1, y2)})") From c2116dea25226d756b55e55489a53f73b89cdf97 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Thu, 17 Oct 2024 15:07:00 -0400 Subject: [PATCH 027/131] Backport PR #28972: Switch macOS 12 runner images to macOS 13 --- .github/workflows/cibuildwheel.yml | 2 +- .github/workflows/tests.yml | 13 ++++++++++++- azure-pipelines.yml | 11 +++++++++++ 3 files changed, 24 insertions(+), 2 deletions(-) diff --git a/.github/workflows/cibuildwheel.yml b/.github/workflows/cibuildwheel.yml index 9de63b14c4fd..a145b5bbcc08 100644 --- a/.github/workflows/cibuildwheel.yml +++ b/.github/workflows/cibuildwheel.yml @@ -124,7 +124,7 @@ jobs: cibw_archs: "aarch64" - os: windows-latest cibw_archs: "auto64" - - os: macos-12 + - os: macos-13 cibw_archs: "x86_64" - os: macos-14 cibw_archs: "arm64" diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index cd4c08e29fb9..4100fda43a36 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -101,7 +101,7 @@ jobs: pyqt6-ver: '!=6.6.0' # https://bugreports.qt.io/projects/PYSIDE/issues/PYSIDE-2346 pyside6-ver: '!=6.5.1' - - os: macos-12 # This runner is on Intel chips. + - os: macos-13 # This runner is on Intel chips. python-version: '3.9' # https://bugreports.qt.io/projects/PYSIDE/issues/PYSIDE-2346 pyside6-ver: '!=6.5.1' @@ -192,6 +192,17 @@ jobs: ;; macOS) brew update + # Periodically, Homebrew updates Python and fails to overwrite the + # existing not-managed-by-Homebrew copy without explicitly being told + # to do so. GitHub/Azure continues to avoid fixing their runner images: + # https://github.com/actions/runner-images/issues/9966 + # so force an overwrite even if there are no Python updates. + # We don't even care about Homebrew's Python because we use the one + # from actions/setup-python. + for python_package in $(brew list | grep python@); do + brew unlink ${python_package} + brew link --overwrite ${python_package} + done brew install ccache ghostscript gobject-introspection gtk4 ninja brew install --cask font-noto-sans-cjk inkscape ;; diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 4c50c543846a..e2829ce81e9f 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -120,6 +120,17 @@ stages: ;; Darwin) brew update + # Periodically, Homebrew updates Python and fails to overwrite the + # existing not-managed-by-Homebrew copy without explicitly being told + # to do so. GitHub/Azure continues to avoid fixing their runner images: + # https://github.com/actions/runner-images/issues/9966 + # so force an overwrite even if there are no Python updates. + # We don't even care about Homebrew's Python because we use the one + # from UsePythonVersion. + for python_package in $(brew list | grep python@); do + brew unlink ${python_package} + brew link --overwrite ${python_package} + done brew install --cask xquartz brew install ccache ffmpeg imagemagick mplayer ninja pkg-config brew install --cask font-noto-sans-cjk-sc From 1f1901baa5ce5788eba5feb63ae12df2eac84975 Mon Sep 17 00:00:00 2001 From: Thomas A Caswell Date: Mon, 7 Oct 2024 16:08:48 +0200 Subject: [PATCH 028/131] Backport PR #28925: TST: handle change in pytest.importorskip behavior --- lib/matplotlib/tests/test_rcparams.py | 8 +++++++- lib/mpl_toolkits/mplot3d/tests/test_axes3d.py | 3 ++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/lib/matplotlib/tests/test_rcparams.py b/lib/matplotlib/tests/test_rcparams.py index 25ae258ffcbb..0aa3ec0ba603 100644 --- a/lib/matplotlib/tests/test_rcparams.py +++ b/lib/matplotlib/tests/test_rcparams.py @@ -5,6 +5,7 @@ from unittest import mock from cycler import cycler, Cycler +from packaging.version import parse as parse_version import pytest import matplotlib as mpl @@ -539,7 +540,12 @@ def test_backend_fallback_headless(tmp_path): sys.platform == "linux" and not _c_internal_utils.xdisplay_is_valid(), reason="headless") def test_backend_fallback_headful(tmp_path): - pytest.importorskip("tkinter") + if parse_version(pytest.__version__) >= parse_version('8.2.0'): + pytest_kwargs = dict(exc_type=ImportError) + else: + pytest_kwargs = {} + + pytest.importorskip("tkinter", **pytest_kwargs) env = {**os.environ, "MPLBACKEND": "", "MPLCONFIGDIR": str(tmp_path)} backend = subprocess_run_for_testing( [sys.executable, "-c", diff --git a/lib/mpl_toolkits/mplot3d/tests/test_axes3d.py b/lib/mpl_toolkits/mplot3d/tests/test_axes3d.py index ff5ab230ef06..20b8dcd432db 100644 --- a/lib/mpl_toolkits/mplot3d/tests/test_axes3d.py +++ b/lib/mpl_toolkits/mplot3d/tests/test_axes3d.py @@ -1,6 +1,7 @@ import functools import itertools import platform +import sys import pytest @@ -114,7 +115,7 @@ def test_axes3d_repr(): @mpl3d_image_comparison(['axes3d_primary_views.png'], style='mpl20', - tol=0.05 if platform.machine() == "arm64" else 0) + tol=0.05 if sys.platform == "darwin" else 0) def test_axes3d_primary_views(): # (elev, azim, roll) views = [(90, -90, 0), # XY From 7b547eacebb0d854152e0e5d1afb3edc5da5ee4d Mon Sep 17 00:00:00 2001 From: Ruth Comer <10599679+rcomer@users.noreply.github.com> Date: Mon, 21 Oct 2024 22:09:44 +0100 Subject: [PATCH 029/131] Backport PR #28993: FIX: contourf hatches use multiple edgecolors --- lib/matplotlib/contour.py | 4 ++++ .../test_contour/contourf_hatch_colors.png | Bin 0 -> 19765 bytes lib/matplotlib/tests/test_contour.py | 8 ++++++++ 3 files changed, 12 insertions(+) create mode 100644 lib/matplotlib/tests/baseline_images/test_contour/contourf_hatch_colors.png diff --git a/lib/matplotlib/contour.py b/lib/matplotlib/contour.py index 0e6068c64b62..3b2bf3843f4d 100644 --- a/lib/matplotlib/contour.py +++ b/lib/matplotlib/contour.py @@ -1415,12 +1415,16 @@ def draw(self, renderer): super().draw(renderer) return # In presence of hatching, draw contours one at a time. + edgecolors = self.get_edgecolors() + if edgecolors.size == 0: + edgecolors = ("none",) for idx in range(n_paths): with cbook._setattr_cm(self, _paths=[paths[idx]]), self._cm_set( hatch=self.hatches[idx % len(self.hatches)], array=[self.get_array()[idx]], linewidths=[self.get_linewidths()[idx % len(self.get_linewidths())]], linestyles=[self.get_linestyles()[idx % len(self.get_linestyles())]], + edgecolors=edgecolors[idx % len(edgecolors)], ): super().draw(renderer) diff --git a/lib/matplotlib/tests/baseline_images/test_contour/contourf_hatch_colors.png b/lib/matplotlib/tests/baseline_images/test_contour/contourf_hatch_colors.png new file mode 100644 index 0000000000000000000000000000000000000000..18d949773ded79b5e931e035032c7f0ee590cd6b GIT binary patch literal 19765 zcmeIa`9GBH8$Ld!DLiExEt1GGDA__;VpJj|o)+1cR7jyjS%)ZFsO&0~Qp(mM5(beL zC4?3=mh2V7U@*q_yzcQl@Av!r`M$n?!RLqPRXwkJ?z!&kKCkmU&f_@FiMH5h#P^rz zUpO3&&v=i)ejE-Tio?6aF}ScDL2p1763^o^w8P3}@zi*88N_*^}-^ zHuxPoZ&TLTAMexojvRA zqphrb>fetmd7W`p-WP8y3SYtNy~o-IhZAr{|8dR>^OM-#_#WxeEYuO zfw_b@xB<#e;dOEPdvZ1%6zwT{Dk>eD9dShJN{_JNvbio7pGE;1SzMVM zSX46g!=u1;J|J^o{+g8i=&qm-YWJS|56pdU`Wm}0OE1_4RvY!Ir;q}F;-1Fh2=LDp zTs%0O;99&O4!209@aKPhR<%Fdy!)C% z>eJz0BaU-lOTR62e~jsEpfy%Z1yZL2*Ry0=iYW6Q^Rpe)_N8m=vX?8BWhZ7ihlDs3 zRn0!I%(uFg5W>jO9=PFSv#|CDWg&QeJeB(CO`@DHy?%{H-`nJp`R~`aEg1KggmW*r zo}w(sQzvv5vfA@!;*Yy7>|B_mEco}*l$&B!kz4E6cy;KE+T}a4$Jfnvg-^g8S1aqG zFIa9<#X3|uJG{+z{AXWW2vuRBOF(pfu35t8S}tk5Zot8Zhl~EqHVhHC2Aw=T_rbr~ zUCDFS^Y3ZD#Am-2+Ao|lBCq=D%@}OHMRp9HY%2&^`0~a2{f7@H-e+joJUMRmkfx(b zCKnxc@ZYUqng6lecSJjux+{`@=;xb68)`^!0e#zG0()@w7MVI$8)jJ5ls(b35Z_)H zY!E3xE8O;j8T*Rrn7K-U|HS-k)9}r6?IRy=eTQc_&ZeEaQ6D={;`!ZD(UBeF;NRzU zcKl~DJj25?>?c8+C$pxdKFr*sw7gyC`Ef4QK6geg^NJqhRtu%!aS_G--6+*@w9_YH z^`D9-4636SwIF%h_d7lg0mc)7Q-kxgh4~iB?)w8)>beDOTf%P~dT43JnvRUZomCMD zeV3xxT4+yeWT{0sm9+@Tmk3{|%WAe{k>Kwd5*G}zyKM=VM9m~`x-@?}$lwwg(2-d8 z_|&(l8y$MI8uJTV_nMgd9g0?OH|o= zbm-lN&DfVi^GHgREBd5R#EMH%rtBVRKh@S#KT)u-LL#Vme*hn0#Wb_m>|d~UxH*wEyX`MlRCybox5m3~x6@6@ zJ*>6%uV~p`lsT_Rc2L`)!`npRshcBtlE&|a86>WHtF_Yz*DfDTy|>Nt(?Z#ljb-gs z_Y)SuH=#W_Aa{7GKKp&xl3n!Fl&TH2eOHRx zd`;7sYO|{;Lo}o7r4i3Xjyw%kmAQIu$4|zCLk5W~ZSGWk9(_4u9DA%+qQk6-Oy0sK zb`s-bM--jm!2(&NuN9=d1kvD_YL_Cac#wKr?>8+Tef&pbVrYZRd=oD{bpyV4zXm>< z{4$kkDi}sL$WG#`dEB&|p_pMvr;8Cba19>y#xpx}&F-=*^CNoqA4iW-RZq))1}o2Q zzQ>akb1^%iIjNz;M=+F-oyZ8!erM%3oFx8reow#eP8GY|xnXr#-9E6CjAg{IOXfm@ z9_n{zg81=QY^!ggE7@n7#BW+<#2I?>MtZcMh4V z=37C^*r~}atS=i{Ai9dOf6C?OdGE8ITUx8(oEl59@t4UPb@)#9)HLtK$0^B$wG46_ zMGBhj7ol^9^Ja%{5w1Q>-zGnrGPdfl*n_@--3y&T6X(>54h0`~I#id{#t^NFn_jww zSG_!wVDiO1d$f6_2}^Nqw!?RrJ(rV(BZl(FEOTmRu1n(IA*FJ1NbsZr?DfO<(@t9} ziL&@OJ;UsS!#((Yt*!b} zAIG%ufve4K)zNgOJ6{qkD!7aPR-(%tqpfjs=nW3Lbz=BQ#DpNl@^ER<^(s{; zCM=))f)r#akh3v~`S5H!PAHV`bR5~Z+|AEYE=8&JR>>Ov%6)`O9w$z0629PTw1MvG zJ3n|+F01q5Xz=KxTOCo=vy+neyT6uRZ98yaMpDE?9o~fgBfOu=iKTXjS@V$+^Lw61 zu#2mLU-H>ll_w>8AI-4h6{c8r(B=3R^!}7d&pGb(Er_t@UKeb|Z7OV8d&}TJQ&WwL zQyQ+lFprsN#oLhkCs~E=I;qHRFR<+x#9rS$j1D-%A@<&jTYpC` z)a;d`s6c$YX?hd!!!DL}@MS7vG$+rt7T#dhUVIaILB}T0c}jXm!oqjj%sR8oItgJ2 z`8Q6uLYt@eOPHp`#CX#-^nEjel;~VfUg0pqA}R0R(k-{UJ4|&q8P?IVr3NB}r8XhUdoGzzv&NR)pxH;9=dwkB~#7edC3w!u`nvVRo6%*FyenS|$ zxLoNY$*Z#M1ncf2_@b-W7pLQdgKy-e!j5jxM!} zT^OLvzxdEQIuy6gn%C&~CzCYhlbzAzy!2$15vLrlk**RCi8qy`?PWw+_U87gHWfHT zj3=QJpVm_rdcS%^R=qOOR2p*cdYh~eO%3f)E`XPjsQ)t3IQyt4?>TX^%m!=&joWZ1 zwXyVK`YnreBa-PRTfS9T}#HYBW= ze?DZ4!jdlDsC^h-GoPbu*nYa}G9tybV*c4`Gjk&{mke%w5^uFqukzJWqG8$b<9bIlDUqRRz9&$aYgW{ zcPXwW3&CRzm-yx)*>byP^kSr*J=gX45!qk!WjTg|Hc{8}=is=TvVGowE zonW-t_caDlEE#xH%zErVgfl(cfu-|bTQ&CU`M_|U*Mgr4Jynkz zR(I!cZR{FlSvEd~s-B8Yz{^PAV)Y{=*6hgNuOt+lu;Qm|=N(pct~YMSE5{4AwWr-7 z{~r>h7`7%_rP@MS>-HgJI+SdBz)a-Pk6z`i$fiN550A&9Id6`0?K+S1|K2`{N_0@) zw&oD4#tA=|J?P3cK;Ou2fvvBfP?}XCWN#ki)6eQvu7UG+ z3SyL;1HpReFj~L?C?|q9R)$qIWEtR0@|`0Y99UQMt^!W0-Khd}^~kplxH>%Y|@ESbBe6 zcpV?~l?|((fp>7}UKmsrtp$epY*%8|QEhfe(@Y#Cb5^DHq}&8Dn*YsO5b+>m!h-OM;;PB z_6Je?Qz`R0rH5BBBU2U?N!g`Nm+7fpDc*JuIw5jbWc4Wj?I*g2Ac~4AJ7p|e?^Tu_ zL(-Eg*0wq>T8k|sF1G&qV|3@24a~&1G-AJBard|1T?Xm4wc)d(6cwK8Wp%J}WzS0c z$aV)!hNzH8VP0O|UY`El5V%ZHN;DM3>%2RpydPUgS+soSkzvm!;PThfT~}oGt}E@- zW|W-zrf1HxY_l>x5pu)|TCbOd10nve9Z?zz z%#=ou{DmlXcuCw%87}6_1d81@-G%M+!#!dE0!^=Tvh-K0muo7~!O=6y{^0E#OqrQm_SHw9N5UZ()KZg_Ue7wVyq z8&f=Ne{`~UWFi^W3Are;f|k*&e;Cx+D;iKx;MTq7*Q%x~8@3eP#R8nxQM11$S;d3) zfr9||u&i@Fpkw1(1n={q06mo*9E5Uo@J(ZF!PfJy?aka}r0SwBNzD5nu>h zoB+)h^`#?tk{(Mkf0T6i>CH&vc=hFu;i0m|WJ)XJi^_T|hDN!`9K@F#4Xwg3 zz}TqjBRk{t^S<^T8IGbJb6hCj_nkuK+Jmz^td4_wztw7y+(WpexcQ{KwcSghA!*fP1Q_uZ*9?6?swzTtp zVa~?xK$h`#P3^6_y$}#7qRYimywyv?;{-jq<=z5H{KI_6Q1#`K!mVqGbh}m?MSgRm z_vz}Pytod&|G>L&IEB`F4URo;aqgsGr@slzJ7e&CZ_)-ruMT)3coi z%>7rH`3GI5s$15c&YN@j`AQOt<~#So07HrZxOmi1zcP+28ww8zUyiDUlK+UJSB~*t z(rg)@_((tUwf_z4A0}2rArU8nNnhq#tK;KFxX1Xy`lVh~L&547i4@9n*MxnW-|Hn^ zPxda$a99M##^l*%%Ddp3zTW3Yobs4zORVQo8VDbEY~f;2JuCk9T2UcUd|z+(0r|zs z_6a*0dhmLt>2j1aw*6VoM3Dv=i^r|io9GRME4Z`!5v*fqWxO5h#xj6CcIsSMBx=In zkoc;{q%7WE>VnqcfIGItKM?}W2P2dRP!b)+Fnd<7xo9u|T(qQ(FNh8y3-j0NzLw%; zL-`-<#RW&_8VBj3DvQBkOIok8;%JIWVznmPGuv8TY{wpRVJ%)rd`0ruhnoVa?6qBy z0OO82tXl>3qYto>VenOc<|U8b3=*HPQ0hZ>*j-&Sxq&H-DN+&6Em~26H54P7kA@bNyQ&Ui>n3nzAtMF`rp=1TtwSL51PA>E%5v8=VSC8Iy;K z`bxA)K*3oy%<_7ozOgp@9Oc|rcG=RsIPJBoLLcpJ)zr%jPxiL^%G})jcN94Xn#U<; z$mcd@hS}-?q`fHA?DMe>9CbFWS)}cM(OsVgbKQfRw%1rDqTq7nZHR(?mO)VIcQaXz zrJa^`s6J}tRl(mUQNz_XCF8v>2CMsf@MCFr7S6m=G-zFW>!!=q#|uJ|gqLj$?D}}B zL5Bhqn+{RnB!2Z7B7DU5On*YY&Pd z=Y6vUz*Mlcz2*@tWkWj7^GAjCKxSZ}jC<3M%3TYM_l=!SLTVWua3YDNK1SzfjKpp! zw}CqMG$Vts1);W|OS6;W^xZWHE(y5?^4OKPu`4y$M0-?L9!B%XK>xU{=h8?~Q$ zK}CCNCv^q)bG5hJtM70-akKCsGB@hq6FK;#yezbJO3~Sq+qRS6Zx_z*Cu~}W{W*5* zt&VFvG8y?6ALwzmo^8>0-(7N$hHgMZBbm2G79H&Jis1R5iGgZRaG!~-DEr!=?3*QCIf1ojHV3dX^2Jw0!AUms zX5dU8t#L1&PwoiHfSLxXi#p{t(?DzIBqH@)C>NKD}CI6x|@OhnTOQOjN5wJM_;~PetVtvQl z2u=xnhFz7@f8H5%#T>YImfrmmZT0I|eP9dyg_z^-l!YmO$+4GlxK@IVfs-D-ctCb{ zwmSR5p3Eybc`GD7)GWPP_S0T49m~D3RD)L3*~aoT_UMN4X9Nj2eeDXwQ)k=a0tRmS zl(>%mxJAi*t+vD^Dpx9KyV2~0*FfiOnxF4VxbDUN^D%3L$+&VGK?seY#5D%z&9jp$ z(c9dKsmbkocn1SRnWh`F~c z42ru2aeRnNiZOD!;P%&qnB#fY97Hp~Y6wI?rMpmp z*ZEVXHc_GtpiTxy^5hCs2-Z12Gk%U_yv>dh{D*9=e$gKb$6*fE3XY*B%9#%b(gHV6 zOlo`b`sj!dh4tltz#=aUm`*ZUQ_qd7UCtnw&YdQcEvBClW ze6oF4`R`|`jL$CfHwY$)hie}h9>^5LT7uoEhw3}Py4zMsj6b!wzN)1`t!CtDB|Hge z{=`)+T4iu=W9;5qY$9|KE-~0iE66)-<5VQ)J){vwlN`VxSC{6v}WZ9OG3@Ej82UYNq+LK*hTeXxw@#CT`UGPeBL@v#cJ z(?6$GZy6m}t9K(Dkq;9tKV>D^mu2N10a3Lp0b7Sl5KyIkUc3S^q>PxcJ`BwX3&a;* zV5(&}yzGDqxn4{UibhP(${Wgw`gxt)ITkGrj@q;6V}_mbrqM#yh}E z%!!5V-%420a5k?wdmv}EN>R`YNLnQC1`Wc`f}YXO!kfv+5_bEzL;g%EB6tI zW|s2kd`5U2KW@}tf^sjy4Q7P?#g@rp9Pl~|n3F`I9<8mTb8kL&JUi*1%b;;nPJS+? z3^w^1qFb-0L<8$S-{;7Vyw!08Jt#odtvJ$xw8gbQKgyHc{$g+*6l?zh3$XM+Qc4!6 zvEUStk)Y@6Z@hj%Vs-ubewXSBD9n(Cp|DQ?SwSZep?I|C=k=wil!m{o0U({s>r`86 z4BHK4z{i|C`Nb6b1FG+3;IcA6C85cM?L}>$5|{i%p|BRF;AJFyOkznA*d~xVfOeX^ z5Y+_x@fiOn$qT>~+UvMnbpU|SfC3Q$@`f$T_>VyR@%6v9!8@^&3+0u77L=Ln-Po)y zf5&J0)48j+I?@Q23SMI{1R9UjE+#X|MXlKz`_5)|Q}0xzb~P#+LU9|C9jA`}=UhRr~OF zhf5=bZy7@AL)g9r(u8t8)AV6Eaq1W+6kC8+a^9VNa5KRr8j_+mR=DfJbKXg@^K<1M z0k5QIuz~CKUuCI5_7I7lymCikb5959An^ZbzH9I?q{}#sAmGtQoXDuVa(3RaeEF2w zn2(Q7MrLMVFg|U}pD4e|mbXE~EQc9_mU}wb`>Zw8!umj!hxrk6+p#j3vPDfTXT1*a zwO*TWccDXhEV)M=Bs&c9V#PXjjrRk%Toho5Lf8H(#$Dy1&yQSO7ba&%ing(JgB`d{ zAxUAUdf#UI6#tu0=D%_jh|(hXB5UsHHLx>g_V_owb3l^rTVk$cZ=$|5D4wD2jq$ye z|M0yHG6+`0liiuqryJIv;}3pcYTU(Q(Ff(=O@(h=V)2(6{_c1}Ebo8gt-Vulb1_jDbTo2DT>j3ga`7}&;`xI2pZ zQ{H|jimyC?$)ku5i%Yn=4)hJgoLR%c@}z7jGJ zq=DU@ydBXHI_CxY?<9M#TRhqo4b_5SmaRhae34GSnv;0`({}-O4OMd|b)E$XogeDa zp#AxQ&-%^qasUeK8PI$>RogfM1*Z+9Ot@=Ru&z5`yE1>I0t5=GLj&-~I6H~VCzDZ& zwc}8VIjor|@L+uk)BM2&acG}pL*tx@Zf&}}NSOu^yNE#(KBJ!8HsEtdIqKxMDgWFs zE>rU*0%Dq7>U=Wnd=PeLCr8v;s~;AY&;C-sV(jDttf)|!rLBR z<`-WjoO(MU1|1G)2#><1f--ujLhj><9^J5O{*F$wm0@q@@R+C{)SF`Kdt~VGt&a1K zPGz~dxo4E4R!D*J(QCeCba~^84Yh&z5mY|D@H$<9zW5WSt7O`htIxXqH7O?WJ49xp zNri94;UDT_ZxxC_3mVg9w~Xh8QJMAU6wLAIxGh}22=I#X;1y9!&o8zTC=ZW&@=9z! ze}#GAJYBAjMyz7AkdF}uL!mK$AY6?;@&>9EqOJktZg%`o6Q0xCGUdvfu#>gctf;#c zcpgq*33uRjyu`;)}}Z5mqoQ9Xj5>t^P% z)#;p0_|sbKJ;d@P?d1WKuxH?N#i(3*2N)$vP()tV+a3V--cF{pz2+3Kzeb!M4uKv6 zyoEY&3%x*39z*)0of#r>a|Gye#x(X6?YM*O^YNwaH7-c2oF=H$$b3BELX~_q*_i@_DQcQk5jB&A>J*eGP!%GX zrsyn*2kn!Xd7ZmhGVm5scy8adi?C~l3cDO>|DyoOAt6Q*G;Z>2&Iqr*Q0Ts8OH^j4S?fH@s+vcQ z2{!gd2r+p}eRBKjHwMRkC^{S0IXcl(nM3B32iy`tD#NIqe?Rr>%eO&V6L4Jx-)eY4 zIEx05b-5}FCEqtMNSmXX%T?G;f}tABaB|t1!6pNz!1Ac-vplQgszq++$vb{{1g0Q} zo3QSTjEuJtPB*i}_phY83Q^uWFa5Q_n#<9@FBuuY7*uvgSR=XhC*q*nrnId#l@jAO z0(p$Vw3b&KwgE`#RVu>OHugU6+h$W2#swlBJkE%|hQJ8~7y|qRR6TfG?oM{)X`qs> zPNepOmT)B#x6jPXy*1Y?19<7us>zOYN>!fw1~`kc5dQ(9B7xAt4T%le))HH*uau~w zEV&g43&Pc3SG=NC1<##*uW{Iwot~QuNSWsWPFF8`k}R)6i{} zrTmt}c@zgs4&P!1j#f^~q$hi86QZm8AwGr#E0|->w>N&ojwY}YJxx;Vul0X@-tib; z)f=z#w76JhCB^-ey`b~@lfEVVDV=~QPN-iD;8%*OyIY8=Ysq>_ekdrgJz(1tUq`uS zV~a?ua_Hea0Tgihi0x`BoE9$jjpH_e1$$&eJM4Vo-m=Ip0kB!c*7i`@eyMwR%BbYJ zWz==}V4V2N6zs@@7JisRG+(P)YG(-C0Whkd0e%s@td-FMtPWtqBqR=7rgD@WSAbzp z_@9;AahpPm1_-Sdlbb+eVm`5&^Gm?}vRDULU;m+iP}+2t+wC{7)AvgDn4hZf9Q2h^ zu}cKygtD66A&?)szAQhq6{vG`I{TtDqEhdx!I>&H3y!Pak`QyXHa>StkfxCXLCQ`|O=n9{+azt(F(HcO zmT2A6Jp@djIfs+YK;|i%;Hc`pceJ)?3CfAVlG{QE#&v)DKVV$PywI6MK}vg+4ED<|el^;G@c`i%o1?zodN9K<*)madfwm10STfN26l_XXui#lu#CH8qib>ZqC zZ(_-L&oNR`IkCDZ#Mk9GQ9jyje;G!e<)Zee{-@U#e6f*Xz2ogXZX@9^OPZ87n|bY4 zQSb>`RSU)Oe)Gz&THwyh1Z`Et4wLj^nF^PH&eJ|zod}#~H0m-QnvZnFDrL03rJYxv zn3Mt#t_woP5K2)Pz565v$@{XQl@?opEwBWiNP(Ui-ZAjhAy`mc73oHlV#X^FoIu*@ z!K@Clls>`G^$&@Q?wYm+o{EtV6jjFL-$EiT>Tx|ISg^iD!5T#!x8l7H9CGLTO5PuN7WYgJ|@P)5!k7PjsWJ5uuNvUENvtdtNFgd*a83&&`JbP>!yO) z;kYQYIFdJe>spSbccd@7xKtM$`7Pz-`TURGR4Z z1*K1j@vku~EkyC;sZP;YMF}65Dn0>O)KWrv?3(G1w-~GTbe`T|y6|1n@Icfevo^%D z{rp&V|G+>rxu}zWX>(ivOV`-q`X|S>x}1FKm!v@2mx9;xVPL zr)w$hL(8QODMx}wWw^Kg%FpRX7_sKrGJ(f>$o~*)|6;w7S)S)oJ7dU7VJciFcc;?j z+DZ|(Kj}-9->AmN>MyjHz8416jkqJ?ysMZ!+Lg?n@)p{<5N5Z)!r8$lZho=*eZY_K zZe%+lEN~S6*_TC9s$}e+@8Vw2myB%vcfZ%#z%m55j zl@sGhSk(qpODxPn84w&d0KLPH0O>(%f}-uGXR0Z64C&BxsApr*=0UY{%ymDo0wbE1X2keM|9Z0A?y~dzrX97y}2pnHKx8tav-?MoMgF43! z9)0r?5cz;ygcU2|W9-;JFi@+}X``Hbz zh0HA71~f-M)&8W2)TE_{kXgyx@ zvyZ=; z5mI_1G?&?Zy)qULw(?z;%!nDsoB%yr_jU8!_tvgLVr=k?`amP*JY75Z7b@`4GH8atH*5RuN9I?E;u?scWD!eOf14PTt z(~o#@5TipB5ZQpPnldZXvAi_^E#l2(dS!v1k>s z1+;{ zJ1BVT1;Y#nn-5+R_%G&qlaSTG&jdJWH&^lj>n1Ns2{(iN{T){uLiJmH=fsox5X^t+`Dqod}+Mc{Kre)F7 zETK?4ygRfqWp!EVvo+0jD<17E6S*co+clVm!MU-n!Lp=EQsc#he!);aN%o2krs?H! zlxlD7?keLpY5_niSc%l0(sEx&X z1SdZBOxD8l#8Fe0b@&=@cmxBd?LzYDf}lHJ`Ec4Mb_*om?jxj5F{Lm~`C02~vkmP0 z)1^fqH}(&tdaKG*$4W*smR>#FQAh&m2b4vg)LpeH>`{@_canB^XZ#?krzwLmcoUfB zzPHni!<5PCz4#@N&%U^K!S;{Te1BoOpbJAPYlE@&shC)}hHG$bPt&H^&U$2{a{4S} z#Q@n8=@-BVf$ZtM0lo`2HdAco*L`J4c#;B_90Vd5FwN4|`gzjJe;L+Yjgqx6q@%zd8;>CE&p-c!%sWanIUo{)eL%|MqM?>zd^gykTVw_@*#7 zLOJ9&nU8KBU=Dvl+AeN}pfbYhnL8hPu{9U(-5;6e7!DK~hdmDnfhG2rq z`-~C-V)9W|b#_5+iM1=L^YRk*Tzl5XO09L`fsa7hAH?)=V62iPE}%97)8y=sUVc;s zcetqP=dY1(rC#q@PXed^fVVh8kishkuE)#OpL5(Tc%U+H<_vtY9siW|HW>hdOTK%! z+8sFS7o%0Ctd051b)V{?W~swm7#3>Q$PdLVdRyFxm^y`ZE2<|xyil9YdOlLPT&-vo zR)~>H_gg)(a?T2dU1JP?Ey4T^*Z=YKd=F$ak6_=`SIMo?bZ2_$RtRel8-&9QoW2;< z@98!?U=8VDboq)UqsVUr#mZPafKgCe8Zlx3Hc2Y?liw&mpA}kc3KDW}V+!89A;O?< z2~M})Bd@(LXt}@9pc#X-sK&?j_CkX)8;kq7<72_MgzvO{+ruqqS!6x zedKO|O>2)ul#jhTOi*&$tVvKTcB?ikajFiQt-1aLH65Cfb@RR5!lOk*2i78dBgb+d=R zzs1ZnrT>^|2G6YDoJ=cjWjj3mHR48t#9oNy+;=Oruxi1H9*KTsvQ+Ao3_ z#$gk{N8Nl$O9+(EW8qw70h6Qx%EIq&rTj3`1Gdh~U?EorFF6cu8FZO#o3|@HbZs%5ku_8lHBFtO5u;zQ#P~Co|hi#YpIQY^BPnw&v z_^@zr0eB9~O1UU^s4e+h4zHr}!tXa^z~Eg)hmf~?(1S%PeBM8d2=U1w7lPi@;IUnf zwx@?zHm@AS*s+=I&QgNDz>Q~nDRe!>j4?1ra#!Q@jtDp{rM_b>3HFx5fE6q_>e14x z0gv#<@gh$*Vdg|dV8!$d<6$xqh$wK~ps5=ehm?&*K5SsPjkEpZ+&4S`TV(bqgmp8r zt#!MAe`UTA+-`>8XfWSSf7JLgr@;&lniFb&OC!ExLBu46MxRDs0+XA_OcSmDG8Gx? z7yVE95#I$t<;>agPY7f7nd0UK-!b&kxBaZBbn(Unp&Pxiwq8vz;v#Yk*q*L$1Qh`L zvh3Oz>Qij;D-Ky3ehu)FD^E)|-|=pu!+-&q0W&O#oOOtXMn7A$G6oQB5xb=x6a(%U zDCt-aYsH(o3(i%%&3A!#rC2QKVqTh)4Bz#e-Fr;RqW+aI%j^CrCtmS3@U1+P}I(E!JHg5IJ?I`pBGZZTw&6j{NDp;$Q1grlqbnB(g|6c ziUvT0ay(sstA(a>P`QfvEk+k|U~hg=@NePtj$w{LytHV<2I%gsvlaX)F_2=xv;*d| zQep_b-uEt*Tw4$Qr#u7#MzOZ}vW#C+6TE^)ieR2krntNc7TF96HPpF1$OE!k!3hx8 zeXg|o6Di1vrO3WUGg^=MfiYF!2ii(JF!PCTBqez!pivUJU0#X!en+x$6)>1hSk9To znvJS|2`dqI06YmW)nNA37V zV3x42)_{If50YHuj36l^~5*Asib$TEtpMa+HANCgY-6w^scYrUT3)wY- z;;=z4m{?2&UG5}F4ABI0T1V`7)lh<~6AMM1&llG$68i%WiA_|(zF7;ompP-?w!Fd+ zo!uKCb4F5_k#$+MvE(pXFtNNIRk7Uu(408BG9jQLzpU<#-sIz6pZq8^n&7 zg4b?DYv_G3PKbO4Fp&U?zx>Tpw;j6X(FKsgFGfWg=jbnY?9>v5(QkVK43sY+X?^q#xp(B^DBFr+&uUk zk0SkZ4CXW2Cd$$Tb2fhRVVs7;2zJ1LO}cy)?AZ~uH3k{rE;v=i{p2+wbGm`d*>rA) zj5!$XlLQ9#I0}Aw_IqOQl0YyizyrS50T^ntSnkI0AMPxdf?h}vEITt`Cn7?io{xvg ziF5=*d8((%f-da&8$dziw~j>A;t8Dq7FQDakm)mG!RL=7OO8mU{CK1O8gvyi@ebnX z)r$DA10V?p{|J`Cu8a^1m8}2;(-hfWu@8&_26(bF2DD{aA9ZWO5#rBc<4{=`(S|wigUqm#SAbj)1 zpK_H6n{Hz5xr z{HVe@^j#&BMP~FIZXRFIU_^Hq#*tmnd@6$6c8no62p|iP^u*fgPeU!Gy5W9dG z4bVv1xj#W=jA^lfcpdg$gud2}a{Wq`8eI;vhA;@RgAl*Qhww@S`S6WeN0-Co5+Pd{ zUz`QwHez&FXnw*G!I3RwgE?kZjasuUJ~V#{&q2f%FV|;B|5kmD(Es}SGT8(fN&L%2 zGdM7HSYgQU;2{Fy5e$19=>1ftN4c7rI1be@nlDpWwYFqNys;v= zSVl_a8vMRQB%1n2QXaV9dw~Z9%vHBp&OrG$jIp_9#m!v?B@ztQnQ0schbwOf{CWe# zYsd)~)P~s8s>FSFL>N0^WRr;|I^P362kki(LNJtl;tY0KL)Os{2{N1hB)ucL`aF2P z`D-|h;(Z`qp+ZaVH$%p^hsyL)_g2~9KR&>nYP8ol7otgNXOOQ^Pf>UY`)cR=DBw^B z1ojkcNJ<5xMVSAC!)Nbv>}w{od`ILnzwTOcXB8mB+ANqhPFqO3bn*Y-ShEAz` zP|CQ-G-iUbqps`E3yHy5BmGz~c5=U93w_LOvtPiuwVqh7GqIo{=Wb(^Ag=r5O{@Ty zRc&MAWpD~MPbR>RJ)J=2E4T0EzV-_uH#gu+_n710!UqXKKc&Ij*KvE^Q7~9_+qQc{ zL++K3=$fmta+I0&jOEk>cGtOPi8sqe3rc^qz|X+I*^^5-JHLc^6g6AVPFnX*wmm#N zA<>^{RdQk#H8vA2S7zzWhSPRaHam!o9*R0|&JVvuwQ=#csItS4y-OLYn)~z4etC{P zO9@>_9h(~z2w5{2%@$0rsu9f&c&j literal 0 HcmV?d00001 diff --git a/lib/matplotlib/tests/test_contour.py b/lib/matplotlib/tests/test_contour.py index 0622c099a20c..a3e00c30ce97 100644 --- a/lib/matplotlib/tests/test_contour.py +++ b/lib/matplotlib/tests/test_contour.py @@ -198,6 +198,14 @@ def test_given_colors_levels_and_extends(split_collections): _maybe_split_collections(split_collections) +@image_comparison(['contourf_hatch_colors'], + remove_text=True, style='mpl20', extensions=['png']) +def test_hatch_colors(): + fig, ax = plt.subplots() + cf = ax.contourf([[0, 1], [1, 2]], hatches=['-', '/', '\\', '//'], cmap='gray') + cf.set_edgecolors(["blue", "grey", "yellow", "red"]) + + @pytest.mark.parametrize("split_collections", [False, True]) @image_comparison(['contour_log_locator.svg'], style='mpl20', remove_text=False) def test_log_locator_levels(split_collections): From 3cf5e95e1c98e5ab3ba955606b2bfd1aa324b911 Mon Sep 17 00:00:00 2001 From: Tim Hoffmann <2836374+timhoffm@users.noreply.github.com> Date: Tue, 22 Oct 2024 11:24:26 +0200 Subject: [PATCH 030/131] Backport PR #29005: DOC: Update meson-python intersphinx link --- doc/conf.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/conf.py b/doc/conf.py index 8036edec9989..04f48204eb77 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -241,7 +241,7 @@ def _check_dependencies(): 'scipy': ('https://docs.scipy.org/doc/scipy/', None), 'tornado': ('https://www.tornadoweb.org/en/stable/', None), 'xarray': ('https://docs.xarray.dev/en/stable/', None), - 'meson-python': ('https://meson-python.readthedocs.io/en/stable/', None) + 'meson-python': ('https://mesonbuild.com/meson-python/', None), } From f3df3a16d1dce3770555d94a386b3f8587f8feba Mon Sep 17 00:00:00 2001 From: Tim Hoffmann <2836374+timhoffm@users.noreply.github.com> Date: Thu, 24 Oct 2024 07:02:26 +0200 Subject: [PATCH 031/131] Backport PR #29014: FIX: fake out setuptools scm in tox on ci --- tox.ini | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tox.ini b/tox.ini index cb2fcc979076..a4fbbd1793ff 100644 --- a/tox.ini +++ b/tox.ini @@ -12,6 +12,8 @@ setenv = MPLCONFIGDIR={envtmpdir}/.matplotlib PIP_USER = 0 PIP_ISOLATED = 1 + SETUPTOOLS_SCM_PRETEND_VERSION_FOR_MATPLOTLIB = 0.0.0 + usedevelop = True commands = pytest --pyargs matplotlib {posargs} From 5882c882d67ef134a6ad758f3f54cb43c25cb05b Mon Sep 17 00:00:00 2001 From: hannah Date: Mon, 28 Oct 2024 18:49:26 -0400 Subject: [PATCH 032/131] Backport PR #27569: DOC: initial tags for statistics section of gallery --- galleries/examples/statistics/boxplot.py | 2 ++ galleries/examples/statistics/boxplot_color.py | 2 ++ galleries/examples/statistics/boxplot_demo.py | 2 ++ galleries/examples/statistics/boxplot_vs_violin.py | 2 ++ galleries/examples/statistics/bxp.py | 2 ++ galleries/examples/statistics/confidence_ellipse.py | 8 ++++++++ galleries/examples/statistics/customized_violin.py | 2 ++ galleries/examples/statistics/errorbar.py | 3 +++ galleries/examples/statistics/errorbar_features.py | 2 ++ galleries/examples/statistics/errorbar_limits.py | 2 ++ galleries/examples/statistics/errorbars_and_boxes.py | 8 ++++++++ galleries/examples/statistics/hexbin_demo.py | 2 ++ galleries/examples/statistics/hist.py | 9 +++++++++ galleries/examples/statistics/histogram_bihistogram.py | 4 ++++ galleries/examples/statistics/histogram_cumulative.py | 2 ++ galleries/examples/statistics/histogram_histtypes.py | 2 ++ galleries/examples/statistics/histogram_multihist.py | 2 ++ galleries/examples/statistics/histogram_normalization.py | 2 ++ .../statistics/multiple_histograms_side_by_side.py | 7 +++++++ galleries/examples/statistics/time_series_histogram.py | 8 ++++++++ galleries/examples/statistics/violinplot.py | 2 ++ 21 files changed, 75 insertions(+) diff --git a/galleries/examples/statistics/boxplot.py b/galleries/examples/statistics/boxplot.py index ccdaab97d24a..6d30cbd4b5f0 100644 --- a/galleries/examples/statistics/boxplot.py +++ b/galleries/examples/statistics/boxplot.py @@ -97,6 +97,8 @@ # %% # +# .. tags:: plot-type: boxplot, domain: statistics +# # .. admonition:: References # # The use of the following functions, methods, classes and modules is shown diff --git a/galleries/examples/statistics/boxplot_color.py b/galleries/examples/statistics/boxplot_color.py index 3491253aaf3e..acdb37d7d520 100644 --- a/galleries/examples/statistics/boxplot_color.py +++ b/galleries/examples/statistics/boxplot_color.py @@ -36,6 +36,8 @@ # %% # +# .. tags:: styling: color, domain: statistics, plot-type: boxplot +# # .. admonition:: References # # The use of the following functions, methods, classes and modules is shown diff --git a/galleries/examples/statistics/boxplot_demo.py b/galleries/examples/statistics/boxplot_demo.py index eca0e152078e..ec23408c0bfc 100644 --- a/galleries/examples/statistics/boxplot_demo.py +++ b/galleries/examples/statistics/boxplot_demo.py @@ -247,6 +247,8 @@ def fake_bootstrapper(n): # %% # +# .. tags:: domain: statistics, plot-type: boxplot +# # .. admonition:: References # # The use of the following functions, methods, classes and modules is shown diff --git a/galleries/examples/statistics/boxplot_vs_violin.py b/galleries/examples/statistics/boxplot_vs_violin.py index dce8912013b0..f277e737e65c 100644 --- a/galleries/examples/statistics/boxplot_vs_violin.py +++ b/galleries/examples/statistics/boxplot_vs_violin.py @@ -54,6 +54,8 @@ # %% # +# .. tags:: plot-type: violin, plot-type: boxplot, domain: statistics +# # .. admonition:: References # # The use of the following functions, methods, classes and modules is shown diff --git a/galleries/examples/statistics/bxp.py b/galleries/examples/statistics/bxp.py index b12bfebd16cc..3ddd164df742 100644 --- a/galleries/examples/statistics/bxp.py +++ b/galleries/examples/statistics/bxp.py @@ -64,6 +64,8 @@ # %% # +# .. tags:: plot-type: speciality, domain: statistics +# # .. admonition:: References # # The use of the following functions, methods, classes and modules is shown diff --git a/galleries/examples/statistics/confidence_ellipse.py b/galleries/examples/statistics/confidence_ellipse.py index 27b06146a44e..4ac0917f4bda 100644 --- a/galleries/examples/statistics/confidence_ellipse.py +++ b/galleries/examples/statistics/confidence_ellipse.py @@ -217,6 +217,14 @@ def get_correlated_dataset(n, dependency, mu, scale): # %% # +# .. tags:: +# +# plot-type: speciality +# plot-type: scatter +# component: ellipse +# component: patch +# domain: statistics +# # .. admonition:: References # # The use of the following functions, methods, classes and modules is shown diff --git a/galleries/examples/statistics/customized_violin.py b/galleries/examples/statistics/customized_violin.py index c1d2e432ca2e..29ddcda92fbe 100644 --- a/galleries/examples/statistics/customized_violin.py +++ b/galleries/examples/statistics/customized_violin.py @@ -73,6 +73,8 @@ def set_axis_style(ax, labels): # %% # +# .. tags:: plot-type: violin, domain: statistics +# # .. admonition:: References # # The use of the following functions, methods, classes and modules is shown diff --git a/galleries/examples/statistics/errorbar.py b/galleries/examples/statistics/errorbar.py index a25cadf88211..019590dc3f32 100644 --- a/galleries/examples/statistics/errorbar.py +++ b/galleries/examples/statistics/errorbar.py @@ -21,6 +21,9 @@ # %% # +# +# .. tags:: plot-type: errorbar, domain: statistics, +# # .. admonition:: References # # The use of the following functions, methods, classes and modules is shown diff --git a/galleries/examples/statistics/errorbar_features.py b/galleries/examples/statistics/errorbar_features.py index 349cc89ff2e0..8abaffcda537 100644 --- a/galleries/examples/statistics/errorbar_features.py +++ b/galleries/examples/statistics/errorbar_features.py @@ -48,6 +48,8 @@ # %% # +# .. tags:: plot-type: errorbar, domain: statistics +# # .. admonition:: References # # The use of the following functions, methods, classes and modules is shown diff --git a/galleries/examples/statistics/errorbar_limits.py b/galleries/examples/statistics/errorbar_limits.py index d5b0e476d894..f1d26460d947 100644 --- a/galleries/examples/statistics/errorbar_limits.py +++ b/galleries/examples/statistics/errorbar_limits.py @@ -77,6 +77,8 @@ # %% # +# .. tags:: plot-type: errorbar, domain: statistics +# # .. admonition:: References # # The use of the following functions, methods, classes and modules is shown diff --git a/galleries/examples/statistics/errorbars_and_boxes.py b/galleries/examples/statistics/errorbars_and_boxes.py index 54c8786096c7..b45eee751137 100644 --- a/galleries/examples/statistics/errorbars_and_boxes.py +++ b/galleries/examples/statistics/errorbars_and_boxes.py @@ -71,6 +71,14 @@ def make_error_boxes(ax, xdata, ydata, xerror, yerror, facecolor='r', # %% # +# +# .. tags:: +# +# plot-type: errorbar +# component: rectangle +# component: patchcollection +# domain: statistics +# # .. admonition:: References # # The use of the following functions, methods, classes and modules is shown diff --git a/galleries/examples/statistics/hexbin_demo.py b/galleries/examples/statistics/hexbin_demo.py index b9a6206a934f..bd1522772aae 100644 --- a/galleries/examples/statistics/hexbin_demo.py +++ b/galleries/examples/statistics/hexbin_demo.py @@ -35,6 +35,8 @@ # %% # +# .. tags:: plot-type: histogram, plot-type: hexbin, domain: statistics +# # .. admonition:: References # # The use of the following functions, methods, classes and modules is shown diff --git a/galleries/examples/statistics/hist.py b/galleries/examples/statistics/hist.py index 8b06093913df..e31aca0228c2 100644 --- a/galleries/examples/statistics/hist.py +++ b/galleries/examples/statistics/hist.py @@ -103,6 +103,15 @@ # %% # +# .. tags:: +# +# plot-type: histogram, +# plot-type: histogram2d +# domain: statistics +# styling: color, +# component: normalization +# component: patch +# # .. admonition:: References # # The use of the following functions, methods, classes and modules is shown diff --git a/galleries/examples/statistics/histogram_bihistogram.py b/galleries/examples/statistics/histogram_bihistogram.py index 7bfae14e9285..73f549493438 100644 --- a/galleries/examples/statistics/histogram_bihistogram.py +++ b/galleries/examples/statistics/histogram_bihistogram.py @@ -43,3 +43,7 @@ ax.legend() plt.show() + +# %% +# +# .. tags:: plot-type: histogram, domain: statistics, purpose: showcase diff --git a/galleries/examples/statistics/histogram_cumulative.py b/galleries/examples/statistics/histogram_cumulative.py index 9ce16568d126..d87305629f8d 100644 --- a/galleries/examples/statistics/histogram_cumulative.py +++ b/galleries/examples/statistics/histogram_cumulative.py @@ -67,6 +67,8 @@ # %% # +# .. tags:: plot-type: ecdf, plot-type: histogram, domain: statistics +# # .. admonition:: References # # The use of the following functions, methods, classes and modules is shown diff --git a/galleries/examples/statistics/histogram_histtypes.py b/galleries/examples/statistics/histogram_histtypes.py index 0188d7bf5d0f..53d6425cf4dc 100644 --- a/galleries/examples/statistics/histogram_histtypes.py +++ b/galleries/examples/statistics/histogram_histtypes.py @@ -51,6 +51,8 @@ # %% # +# .. tags:: plot-type: histogram, domain: statistics, purpose: reference +# # .. admonition:: References # # The use of the following functions, methods, classes and modules is shown diff --git a/galleries/examples/statistics/histogram_multihist.py b/galleries/examples/statistics/histogram_multihist.py index f1957dc38939..78ff03719057 100644 --- a/galleries/examples/statistics/histogram_multihist.py +++ b/galleries/examples/statistics/histogram_multihist.py @@ -47,6 +47,8 @@ # %% # +# .. tags:: plot-type: histogram, domain: statistics, purpose: reference +# # .. admonition:: References # # The use of the following functions, methods, classes and modules is shown diff --git a/galleries/examples/statistics/histogram_normalization.py b/galleries/examples/statistics/histogram_normalization.py index 9418b7af002b..2c423edad208 100644 --- a/galleries/examples/statistics/histogram_normalization.py +++ b/galleries/examples/statistics/histogram_normalization.py @@ -243,6 +243,8 @@ # %% # +# .. tags:: plot-type: histogram, domain: statistics +# # .. admonition:: References # # The use of the following functions, methods, classes and modules is shown diff --git a/galleries/examples/statistics/multiple_histograms_side_by_side.py b/galleries/examples/statistics/multiple_histograms_side_by_side.py index 3c5766f8e546..733aed51f253 100644 --- a/galleries/examples/statistics/multiple_histograms_side_by_side.py +++ b/galleries/examples/statistics/multiple_histograms_side_by_side.py @@ -63,6 +63,13 @@ # %% # +# .. tags:: +# +# domain: statistics +# plot-type: barh +# plot-type: histogram +# styling: position +# # .. admonition:: References # # The use of the following functions, methods, classes and modules is shown diff --git a/galleries/examples/statistics/time_series_histogram.py b/galleries/examples/statistics/time_series_histogram.py index 371d182915b8..6f9a543fb4e5 100644 --- a/galleries/examples/statistics/time_series_histogram.py +++ b/galleries/examples/statistics/time_series_histogram.py @@ -94,6 +94,14 @@ # %% # +# .. tags:: +# +# plot-type: histogram2d +# plot-type: pcolormesh +# purpose: storytelling +# styling: color +# component: colormap +# # .. admonition:: References # # The use of the following functions, methods, classes and modules is shown diff --git a/galleries/examples/statistics/violinplot.py b/galleries/examples/statistics/violinplot.py index afcc1c977034..3d0d44538032 100644 --- a/galleries/examples/statistics/violinplot.py +++ b/galleries/examples/statistics/violinplot.py @@ -106,6 +106,8 @@ # %% # +# .. tags:: plot-type: violin, domain: statistics +# # .. admonition:: References # # The use of the following functions, methods, classes and modules is shown From af21823d513c6c01d9b8037fa6c2e68ab90fedfe Mon Sep 17 00:00:00 2001 From: hannah Date: Mon, 28 Oct 2024 18:49:26 -0400 Subject: [PATCH 033/131] Backport PR #27569: DOC: initial tags for statistics section of gallery --- galleries/examples/statistics/boxplot.py | 2 ++ galleries/examples/statistics/boxplot_color.py | 2 ++ galleries/examples/statistics/boxplot_demo.py | 2 ++ galleries/examples/statistics/boxplot_vs_violin.py | 2 ++ galleries/examples/statistics/bxp.py | 2 ++ galleries/examples/statistics/confidence_ellipse.py | 8 ++++++++ galleries/examples/statistics/customized_violin.py | 2 ++ galleries/examples/statistics/errorbar.py | 3 +++ galleries/examples/statistics/errorbar_features.py | 2 ++ galleries/examples/statistics/errorbar_limits.py | 2 ++ galleries/examples/statistics/errorbars_and_boxes.py | 8 ++++++++ galleries/examples/statistics/hexbin_demo.py | 2 ++ galleries/examples/statistics/hist.py | 9 +++++++++ galleries/examples/statistics/histogram_bihistogram.py | 4 ++++ galleries/examples/statistics/histogram_cumulative.py | 2 ++ galleries/examples/statistics/histogram_histtypes.py | 2 ++ galleries/examples/statistics/histogram_multihist.py | 2 ++ galleries/examples/statistics/histogram_normalization.py | 2 ++ .../statistics/multiple_histograms_side_by_side.py | 7 +++++++ galleries/examples/statistics/time_series_histogram.py | 8 ++++++++ galleries/examples/statistics/violinplot.py | 2 ++ 21 files changed, 75 insertions(+) diff --git a/galleries/examples/statistics/boxplot.py b/galleries/examples/statistics/boxplot.py index ccdaab97d24a..6d30cbd4b5f0 100644 --- a/galleries/examples/statistics/boxplot.py +++ b/galleries/examples/statistics/boxplot.py @@ -97,6 +97,8 @@ # %% # +# .. tags:: plot-type: boxplot, domain: statistics +# # .. admonition:: References # # The use of the following functions, methods, classes and modules is shown diff --git a/galleries/examples/statistics/boxplot_color.py b/galleries/examples/statistics/boxplot_color.py index 3491253aaf3e..acdb37d7d520 100644 --- a/galleries/examples/statistics/boxplot_color.py +++ b/galleries/examples/statistics/boxplot_color.py @@ -36,6 +36,8 @@ # %% # +# .. tags:: styling: color, domain: statistics, plot-type: boxplot +# # .. admonition:: References # # The use of the following functions, methods, classes and modules is shown diff --git a/galleries/examples/statistics/boxplot_demo.py b/galleries/examples/statistics/boxplot_demo.py index eca0e152078e..ec23408c0bfc 100644 --- a/galleries/examples/statistics/boxplot_demo.py +++ b/galleries/examples/statistics/boxplot_demo.py @@ -247,6 +247,8 @@ def fake_bootstrapper(n): # %% # +# .. tags:: domain: statistics, plot-type: boxplot +# # .. admonition:: References # # The use of the following functions, methods, classes and modules is shown diff --git a/galleries/examples/statistics/boxplot_vs_violin.py b/galleries/examples/statistics/boxplot_vs_violin.py index dce8912013b0..f277e737e65c 100644 --- a/galleries/examples/statistics/boxplot_vs_violin.py +++ b/galleries/examples/statistics/boxplot_vs_violin.py @@ -54,6 +54,8 @@ # %% # +# .. tags:: plot-type: violin, plot-type: boxplot, domain: statistics +# # .. admonition:: References # # The use of the following functions, methods, classes and modules is shown diff --git a/galleries/examples/statistics/bxp.py b/galleries/examples/statistics/bxp.py index b12bfebd16cc..3ddd164df742 100644 --- a/galleries/examples/statistics/bxp.py +++ b/galleries/examples/statistics/bxp.py @@ -64,6 +64,8 @@ # %% # +# .. tags:: plot-type: speciality, domain: statistics +# # .. admonition:: References # # The use of the following functions, methods, classes and modules is shown diff --git a/galleries/examples/statistics/confidence_ellipse.py b/galleries/examples/statistics/confidence_ellipse.py index 27b06146a44e..4ac0917f4bda 100644 --- a/galleries/examples/statistics/confidence_ellipse.py +++ b/galleries/examples/statistics/confidence_ellipse.py @@ -217,6 +217,14 @@ def get_correlated_dataset(n, dependency, mu, scale): # %% # +# .. tags:: +# +# plot-type: speciality +# plot-type: scatter +# component: ellipse +# component: patch +# domain: statistics +# # .. admonition:: References # # The use of the following functions, methods, classes and modules is shown diff --git a/galleries/examples/statistics/customized_violin.py b/galleries/examples/statistics/customized_violin.py index c1d2e432ca2e..29ddcda92fbe 100644 --- a/galleries/examples/statistics/customized_violin.py +++ b/galleries/examples/statistics/customized_violin.py @@ -73,6 +73,8 @@ def set_axis_style(ax, labels): # %% # +# .. tags:: plot-type: violin, domain: statistics +# # .. admonition:: References # # The use of the following functions, methods, classes and modules is shown diff --git a/galleries/examples/statistics/errorbar.py b/galleries/examples/statistics/errorbar.py index a25cadf88211..019590dc3f32 100644 --- a/galleries/examples/statistics/errorbar.py +++ b/galleries/examples/statistics/errorbar.py @@ -21,6 +21,9 @@ # %% # +# +# .. tags:: plot-type: errorbar, domain: statistics, +# # .. admonition:: References # # The use of the following functions, methods, classes and modules is shown diff --git a/galleries/examples/statistics/errorbar_features.py b/galleries/examples/statistics/errorbar_features.py index 349cc89ff2e0..8abaffcda537 100644 --- a/galleries/examples/statistics/errorbar_features.py +++ b/galleries/examples/statistics/errorbar_features.py @@ -48,6 +48,8 @@ # %% # +# .. tags:: plot-type: errorbar, domain: statistics +# # .. admonition:: References # # The use of the following functions, methods, classes and modules is shown diff --git a/galleries/examples/statistics/errorbar_limits.py b/galleries/examples/statistics/errorbar_limits.py index d5b0e476d894..f1d26460d947 100644 --- a/galleries/examples/statistics/errorbar_limits.py +++ b/galleries/examples/statistics/errorbar_limits.py @@ -77,6 +77,8 @@ # %% # +# .. tags:: plot-type: errorbar, domain: statistics +# # .. admonition:: References # # The use of the following functions, methods, classes and modules is shown diff --git a/galleries/examples/statistics/errorbars_and_boxes.py b/galleries/examples/statistics/errorbars_and_boxes.py index 54c8786096c7..b45eee751137 100644 --- a/galleries/examples/statistics/errorbars_and_boxes.py +++ b/galleries/examples/statistics/errorbars_and_boxes.py @@ -71,6 +71,14 @@ def make_error_boxes(ax, xdata, ydata, xerror, yerror, facecolor='r', # %% # +# +# .. tags:: +# +# plot-type: errorbar +# component: rectangle +# component: patchcollection +# domain: statistics +# # .. admonition:: References # # The use of the following functions, methods, classes and modules is shown diff --git a/galleries/examples/statistics/hexbin_demo.py b/galleries/examples/statistics/hexbin_demo.py index b9a6206a934f..bd1522772aae 100644 --- a/galleries/examples/statistics/hexbin_demo.py +++ b/galleries/examples/statistics/hexbin_demo.py @@ -35,6 +35,8 @@ # %% # +# .. tags:: plot-type: histogram, plot-type: hexbin, domain: statistics +# # .. admonition:: References # # The use of the following functions, methods, classes and modules is shown diff --git a/galleries/examples/statistics/hist.py b/galleries/examples/statistics/hist.py index 8b06093913df..e31aca0228c2 100644 --- a/galleries/examples/statistics/hist.py +++ b/galleries/examples/statistics/hist.py @@ -103,6 +103,15 @@ # %% # +# .. tags:: +# +# plot-type: histogram, +# plot-type: histogram2d +# domain: statistics +# styling: color, +# component: normalization +# component: patch +# # .. admonition:: References # # The use of the following functions, methods, classes and modules is shown diff --git a/galleries/examples/statistics/histogram_bihistogram.py b/galleries/examples/statistics/histogram_bihistogram.py index 7bfae14e9285..73f549493438 100644 --- a/galleries/examples/statistics/histogram_bihistogram.py +++ b/galleries/examples/statistics/histogram_bihistogram.py @@ -43,3 +43,7 @@ ax.legend() plt.show() + +# %% +# +# .. tags:: plot-type: histogram, domain: statistics, purpose: showcase diff --git a/galleries/examples/statistics/histogram_cumulative.py b/galleries/examples/statistics/histogram_cumulative.py index 9ce16568d126..d87305629f8d 100644 --- a/galleries/examples/statistics/histogram_cumulative.py +++ b/galleries/examples/statistics/histogram_cumulative.py @@ -67,6 +67,8 @@ # %% # +# .. tags:: plot-type: ecdf, plot-type: histogram, domain: statistics +# # .. admonition:: References # # The use of the following functions, methods, classes and modules is shown diff --git a/galleries/examples/statistics/histogram_histtypes.py b/galleries/examples/statistics/histogram_histtypes.py index 0188d7bf5d0f..53d6425cf4dc 100644 --- a/galleries/examples/statistics/histogram_histtypes.py +++ b/galleries/examples/statistics/histogram_histtypes.py @@ -51,6 +51,8 @@ # %% # +# .. tags:: plot-type: histogram, domain: statistics, purpose: reference +# # .. admonition:: References # # The use of the following functions, methods, classes and modules is shown diff --git a/galleries/examples/statistics/histogram_multihist.py b/galleries/examples/statistics/histogram_multihist.py index f1957dc38939..78ff03719057 100644 --- a/galleries/examples/statistics/histogram_multihist.py +++ b/galleries/examples/statistics/histogram_multihist.py @@ -47,6 +47,8 @@ # %% # +# .. tags:: plot-type: histogram, domain: statistics, purpose: reference +# # .. admonition:: References # # The use of the following functions, methods, classes and modules is shown diff --git a/galleries/examples/statistics/histogram_normalization.py b/galleries/examples/statistics/histogram_normalization.py index 9418b7af002b..2c423edad208 100644 --- a/galleries/examples/statistics/histogram_normalization.py +++ b/galleries/examples/statistics/histogram_normalization.py @@ -243,6 +243,8 @@ # %% # +# .. tags:: plot-type: histogram, domain: statistics +# # .. admonition:: References # # The use of the following functions, methods, classes and modules is shown diff --git a/galleries/examples/statistics/multiple_histograms_side_by_side.py b/galleries/examples/statistics/multiple_histograms_side_by_side.py index 3c5766f8e546..733aed51f253 100644 --- a/galleries/examples/statistics/multiple_histograms_side_by_side.py +++ b/galleries/examples/statistics/multiple_histograms_side_by_side.py @@ -63,6 +63,13 @@ # %% # +# .. tags:: +# +# domain: statistics +# plot-type: barh +# plot-type: histogram +# styling: position +# # .. admonition:: References # # The use of the following functions, methods, classes and modules is shown diff --git a/galleries/examples/statistics/time_series_histogram.py b/galleries/examples/statistics/time_series_histogram.py index 371d182915b8..6f9a543fb4e5 100644 --- a/galleries/examples/statistics/time_series_histogram.py +++ b/galleries/examples/statistics/time_series_histogram.py @@ -94,6 +94,14 @@ # %% # +# .. tags:: +# +# plot-type: histogram2d +# plot-type: pcolormesh +# purpose: storytelling +# styling: color +# component: colormap +# # .. admonition:: References # # The use of the following functions, methods, classes and modules is shown diff --git a/galleries/examples/statistics/violinplot.py b/galleries/examples/statistics/violinplot.py index afcc1c977034..3d0d44538032 100644 --- a/galleries/examples/statistics/violinplot.py +++ b/galleries/examples/statistics/violinplot.py @@ -106,6 +106,8 @@ # %% # +# .. tags:: plot-type: violin, domain: statistics +# # .. admonition:: References # # The use of the following functions, methods, classes and modules is shown From d6270b1ec462118f8181f98442a985d5e0a99a24 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Mon, 28 Oct 2024 23:05:33 -0400 Subject: [PATCH 034/131] Backport PR #29031: DOC: Fix copy-paste typo in ColorSequenceRegistry --- lib/matplotlib/colors.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/matplotlib/colors.py b/lib/matplotlib/colors.py index 5f40e7b0fb9a..2c0d1b5d9a4f 100644 --- a/lib/matplotlib/colors.py +++ b/lib/matplotlib/colors.py @@ -105,7 +105,7 @@ class ColorSequenceRegistry(Mapping): Read access uses a dict-like interface mapping names to lists of colors:: import matplotlib as mpl - cmap = mpl.color_sequences['tab10'] + colors = mpl.color_sequences['tab10'] The returned lists are copies, so that their modification does not change the global definition of the color sequence. From f9e680177baf36ffa237a49af5fa993b677d7b38 Mon Sep 17 00:00:00 2001 From: Tim Hoffmann <2836374+timhoffm@users.noreply.github.com> Date: Tue, 29 Oct 2024 10:56:09 +0100 Subject: [PATCH 035/131] Backport PR #29036: Don't pass redundant inline=True to example clabel() calls. --- .../images_contours_and_fields/contour_demo.py | 12 ++++++------ .../images_contours_and_fields/contour_label_demo.py | 4 ++-- galleries/examples/misc/demo_agg_filter.py | 1 - 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/galleries/examples/images_contours_and_fields/contour_demo.py b/galleries/examples/images_contours_and_fields/contour_demo.py index 1d64986850f5..885a8a3c2005 100644 --- a/galleries/examples/images_contours_and_fields/contour_demo.py +++ b/galleries/examples/images_contours_and_fields/contour_demo.py @@ -30,7 +30,7 @@ fig, ax = plt.subplots() CS = ax.contour(X, Y, Z) -ax.clabel(CS, inline=True, fontsize=10) +ax.clabel(CS, fontsize=10) ax.set_title('Simplest default with labels') # %% @@ -42,7 +42,7 @@ CS = ax.contour(X, Y, Z) manual_locations = [ (-1, -1.4), (-0.62, -0.7), (-2, 0.5), (1.7, 1.2), (2.0, 1.4), (2.4, 1.7)] -ax.clabel(CS, inline=True, fontsize=10, manual=manual_locations) +ax.clabel(CS, fontsize=10, manual=manual_locations) ax.set_title('labels at selected locations') # %% @@ -50,7 +50,7 @@ fig, ax = plt.subplots() CS = ax.contour(X, Y, Z, 6, colors='k') # Negative contours default to dashed. -ax.clabel(CS, fontsize=9, inline=True) +ax.clabel(CS, fontsize=9) ax.set_title('Single color - negative contours dashed') # %% @@ -59,7 +59,7 @@ plt.rcParams['contour.negative_linestyle'] = 'solid' fig, ax = plt.subplots() CS = ax.contour(X, Y, Z, 6, colors='k') # Negative contours default to dashed. -ax.clabel(CS, fontsize=9, inline=True) +ax.clabel(CS, fontsize=9) ax.set_title('Single color - negative contours solid') # %% @@ -70,7 +70,7 @@ linewidths=np.arange(.5, 4, .5), colors=('r', 'green', 'blue', (1, 1, 0), '#afeeee', '0.5'), ) -ax.clabel(CS, fontsize=9, inline=True) +ax.clabel(CS, fontsize=9) ax.set_title('Crazy lines') # %% @@ -90,7 +90,7 @@ CS.set_linewidth(lws) ax.clabel(CS, levels[1::2], # label every second level - inline=True, fmt='%1.1f', fontsize=14) + fmt='%1.1f', fontsize=14) # make a colorbar for the contour lines CB = fig.colorbar(CS, shrink=0.8) diff --git a/galleries/examples/images_contours_and_fields/contour_label_demo.py b/galleries/examples/images_contours_and_fields/contour_label_demo.py index 57f29c827757..0b24b57f6afd 100644 --- a/galleries/examples/images_contours_and_fields/contour_label_demo.py +++ b/galleries/examples/images_contours_and_fields/contour_label_demo.py @@ -43,7 +43,7 @@ def fmt(x): fig, ax = plt.subplots() CS = ax.contour(X, Y, Z) -ax.clabel(CS, CS.levels, inline=True, fmt=fmt, fontsize=10) +ax.clabel(CS, CS.levels, fmt=fmt, fontsize=10) # %% # Label contours with arbitrary strings using a dictionary @@ -59,7 +59,7 @@ def fmt(x): fmt[l] = s # Label every other level using strings -ax1.clabel(CS1, CS1.levels[::2], inline=True, fmt=fmt, fontsize=10) +ax1.clabel(CS1, CS1.levels[::2], fmt=fmt, fontsize=10) # %% # Use a Formatter diff --git a/galleries/examples/misc/demo_agg_filter.py b/galleries/examples/misc/demo_agg_filter.py index 5c2ad71a6673..302250ced9f0 100644 --- a/galleries/examples/misc/demo_agg_filter.py +++ b/galleries/examples/misc/demo_agg_filter.py @@ -188,7 +188,6 @@ def filtered_text(ax): # contour label cl = ax.clabel(CS, levels[1::2], # label every second level - inline=True, fmt='%1.1f', fontsize=11) From 9b1b45bf8bb30609f7155305000b4aebbc61ec39 Mon Sep 17 00:00:00 2001 From: Tim Hoffmann <2836374+timhoffm@users.noreply.github.com> Date: Tue, 29 Oct 2024 10:56:09 +0100 Subject: [PATCH 036/131] Backport PR #29036: Don't pass redundant inline=True to example clabel() calls. --- .../images_contours_and_fields/contour_demo.py | 12 ++++++------ .../images_contours_and_fields/contour_label_demo.py | 4 ++-- galleries/examples/misc/demo_agg_filter.py | 1 - 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/galleries/examples/images_contours_and_fields/contour_demo.py b/galleries/examples/images_contours_and_fields/contour_demo.py index 1d64986850f5..885a8a3c2005 100644 --- a/galleries/examples/images_contours_and_fields/contour_demo.py +++ b/galleries/examples/images_contours_and_fields/contour_demo.py @@ -30,7 +30,7 @@ fig, ax = plt.subplots() CS = ax.contour(X, Y, Z) -ax.clabel(CS, inline=True, fontsize=10) +ax.clabel(CS, fontsize=10) ax.set_title('Simplest default with labels') # %% @@ -42,7 +42,7 @@ CS = ax.contour(X, Y, Z) manual_locations = [ (-1, -1.4), (-0.62, -0.7), (-2, 0.5), (1.7, 1.2), (2.0, 1.4), (2.4, 1.7)] -ax.clabel(CS, inline=True, fontsize=10, manual=manual_locations) +ax.clabel(CS, fontsize=10, manual=manual_locations) ax.set_title('labels at selected locations') # %% @@ -50,7 +50,7 @@ fig, ax = plt.subplots() CS = ax.contour(X, Y, Z, 6, colors='k') # Negative contours default to dashed. -ax.clabel(CS, fontsize=9, inline=True) +ax.clabel(CS, fontsize=9) ax.set_title('Single color - negative contours dashed') # %% @@ -59,7 +59,7 @@ plt.rcParams['contour.negative_linestyle'] = 'solid' fig, ax = plt.subplots() CS = ax.contour(X, Y, Z, 6, colors='k') # Negative contours default to dashed. -ax.clabel(CS, fontsize=9, inline=True) +ax.clabel(CS, fontsize=9) ax.set_title('Single color - negative contours solid') # %% @@ -70,7 +70,7 @@ linewidths=np.arange(.5, 4, .5), colors=('r', 'green', 'blue', (1, 1, 0), '#afeeee', '0.5'), ) -ax.clabel(CS, fontsize=9, inline=True) +ax.clabel(CS, fontsize=9) ax.set_title('Crazy lines') # %% @@ -90,7 +90,7 @@ CS.set_linewidth(lws) ax.clabel(CS, levels[1::2], # label every second level - inline=True, fmt='%1.1f', fontsize=14) + fmt='%1.1f', fontsize=14) # make a colorbar for the contour lines CB = fig.colorbar(CS, shrink=0.8) diff --git a/galleries/examples/images_contours_and_fields/contour_label_demo.py b/galleries/examples/images_contours_and_fields/contour_label_demo.py index 57f29c827757..0b24b57f6afd 100644 --- a/galleries/examples/images_contours_and_fields/contour_label_demo.py +++ b/galleries/examples/images_contours_and_fields/contour_label_demo.py @@ -43,7 +43,7 @@ def fmt(x): fig, ax = plt.subplots() CS = ax.contour(X, Y, Z) -ax.clabel(CS, CS.levels, inline=True, fmt=fmt, fontsize=10) +ax.clabel(CS, CS.levels, fmt=fmt, fontsize=10) # %% # Label contours with arbitrary strings using a dictionary @@ -59,7 +59,7 @@ def fmt(x): fmt[l] = s # Label every other level using strings -ax1.clabel(CS1, CS1.levels[::2], inline=True, fmt=fmt, fontsize=10) +ax1.clabel(CS1, CS1.levels[::2], fmt=fmt, fontsize=10) # %% # Use a Formatter diff --git a/galleries/examples/misc/demo_agg_filter.py b/galleries/examples/misc/demo_agg_filter.py index 5c2ad71a6673..302250ced9f0 100644 --- a/galleries/examples/misc/demo_agg_filter.py +++ b/galleries/examples/misc/demo_agg_filter.py @@ -188,7 +188,6 @@ def filtered_text(ax): # contour label cl = ax.clabel(CS, levels[1::2], # label every second level - inline=True, fmt='%1.1f', fontsize=11) From befcf72e1610f28e634c9b2d6479294992d0d918 Mon Sep 17 00:00:00 2001 From: Greg Lucas Date: Tue, 29 Oct 2024 14:56:23 -0600 Subject: [PATCH 037/131] Backport PR #29035: FIX: Don't set_wmclass on GTK3 --- lib/matplotlib/backends/_backend_gtk.py | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/matplotlib/backends/_backend_gtk.py b/lib/matplotlib/backends/_backend_gtk.py index 565d92932023..ac443730e28a 100644 --- a/lib/matplotlib/backends/_backend_gtk.py +++ b/lib/matplotlib/backends/_backend_gtk.py @@ -143,7 +143,6 @@ def __init__(self, canvas, num): super().__init__(canvas, num) if gtk_ver == 3: - self.window.set_wmclass("matplotlib", "Matplotlib") icon_ext = "png" if sys.platform == "win32" else "svg" self.window.set_icon_from_file( str(cbook._get_data_path(f"images/matplotlib.{icon_ext}"))) From 985e8f4f92c35518fd452e95c127425411e36fd8 Mon Sep 17 00:00:00 2001 From: Thomas A Caswell Date: Wed, 30 Oct 2024 16:05:32 -0400 Subject: [PATCH 038/131] Backport PR #28981: FIX: macos: Use standard NSApp run loop in our input hook --- src/_macosx.m | 110 +++++++++++++++++++++++++------------------------- 1 file changed, 56 insertions(+), 54 deletions(-) diff --git a/src/_macosx.m b/src/_macosx.m index fda928536ab5..1f291b52f6ba 100755 --- a/src/_macosx.m +++ b/src/_macosx.m @@ -40,60 +40,84 @@ static bool keyChangeCapsLock = false; /* Keep track of the current mouse up/down state for open/closed cursor hand */ static bool leftMouseGrabbing = false; -/* Keep track of whether stdin has been received */ -static bool stdin_received = false; -static bool stdin_sigint = false; // Global variable to store the original SIGINT handler static PyOS_sighandler_t originalSigintAction = NULL; -// Signal handler for SIGINT, only sets a flag to exit the run loop +// Stop the current app's run loop, sending an event to ensure it actually stops +static void stopWithEvent() { + [NSApp stop: nil]; + // Post an event to trigger the actual stopping. + [NSApp postEvent: [NSEvent otherEventWithType: NSEventTypeApplicationDefined + location: NSZeroPoint + modifierFlags: 0 + timestamp: 0 + windowNumber: 0 + context: nil + subtype: 0 + data1: 0 + data2: 0] + atStart: YES]; +} + +// Signal handler for SIGINT, only argument matching for stopWithEvent static void handleSigint(int signal) { - stdin_sigint = true; + stopWithEvent(); +} + +// Helper function to flush all events. +// This is needed in some instances to ensure e.g. that windows are properly closed. +// It is used in the input hook as well as wrapped in a version callable from Python. +static void flushEvents() { + while (true) { + NSEvent* event = [NSApp nextEventMatchingMask: NSEventMaskAny + untilDate: [NSDate distantPast] + inMode: NSDefaultRunLoopMode + dequeue: YES]; + if (!event) { + break; + } + [NSApp sendEvent:event]; + } } static int wait_for_stdin() { - @autoreleasepool { - stdin_received = false; - stdin_sigint = false; + // Short circuit if no windows are active + // Rely on Python's input handling to manage CPU usage + // This queries the NSApp, rather than using our FigureWindowCount because that is decremented when events still + // need to be processed to properly close the windows. + if (![[NSApp windows] count]) { + flushEvents(); + return 1; + } + @autoreleasepool { // Set up a SIGINT handler to interrupt the event loop if ctrl+c comes in too originalSigintAction = PyOS_setsig(SIGINT, handleSigint); // Create an NSFileHandle for standard input NSFileHandle *stdinHandle = [NSFileHandle fileHandleWithStandardInput]; + // Register for data available notifications on standard input - [[NSNotificationCenter defaultCenter] addObserverForName: NSFileHandleDataAvailableNotification - object: stdinHandle - queue: [NSOperationQueue mainQueue] // Use the main queue - usingBlock: ^(NSNotification *notification) { - // Mark that input has been received - stdin_received = true; - } + id notificationID = [[NSNotificationCenter defaultCenter] addObserverForName: NSFileHandleDataAvailableNotification + object: stdinHandle + queue: [NSOperationQueue mainQueue] // Use the main queue + usingBlock: ^(NSNotification *notification) {stopWithEvent();} ]; // Wait in the background for anything that happens to stdin [stdinHandle waitForDataInBackgroundAndNotify]; - // continuously run an event loop until the stdin_received flag is set to exit - while (!stdin_received && !stdin_sigint) { - // This loop is similar to the main event loop and flush_events which have - // Py_[BEGIN|END]_ALLOW_THREADS surrounding the loop. - // This should not be necessary here because PyOS_InputHook releases the GIL for us. - while (true) { - NSEvent *event = [NSApp nextEventMatchingMask: NSEventMaskAny - untilDate: [NSDate distantPast] - inMode: NSDefaultRunLoopMode - dequeue: YES]; - if (!event) { break; } - [NSApp sendEvent: event]; - } - } + // Run the application's event loop, which will be interrupted on stdin or SIGINT + [NSApp run]; + // Remove the input handler as an observer - [[NSNotificationCenter defaultCenter] removeObserver: stdinHandle]; + [[NSNotificationCenter defaultCenter] removeObserver: notificationID]; + // Restore the original SIGINT handler upon exiting the function PyOS_setsig(SIGINT, originalSigintAction); + return 1; } } @@ -236,18 +260,7 @@ static void lazy_init(void) { static PyObject* stop(PyObject* self) { - [NSApp stop: nil]; - // Post an event to trigger the actual stopping. - [NSApp postEvent: [NSEvent otherEventWithType: NSEventTypeApplicationDefined - location: NSZeroPoint - modifierFlags: 0 - timestamp: 0 - windowNumber: 0 - context: nil - subtype: 0 - data1: 0 - data2: 0] - atStart: YES]; + stopWithEvent(); Py_RETURN_NONE; } @@ -382,20 +395,9 @@ static CGFloat _get_device_scale(CGContextRef cr) // We run the app, matching any events that are waiting in the queue // to process, breaking out of the loop when no events remain and // displaying the canvas if needed. - NSEvent *event; - Py_BEGIN_ALLOW_THREADS - while (true) { - event = [NSApp nextEventMatchingMask: NSEventMaskAny - untilDate: [NSDate distantPast] - inMode: NSDefaultRunLoopMode - dequeue: YES]; - if (!event) { - break; - } - [NSApp sendEvent:event]; - } + flushEvents(); Py_END_ALLOW_THREADS From f7c33fbea5c1d0ba34523c6b169ccf071593d761 Mon Sep 17 00:00:00 2001 From: Kyle Sunden Date: Thu, 31 Oct 2024 20:55:36 -0500 Subject: [PATCH 039/131] Github stats v3.10.0rc1 --- doc/users/github_stats.rst | 497 +++++++++++++++--- .../prev_whats_new/github_stats_3.9.0.rst | 2 +- .../prev_whats_new/github_stats_3.9.2.rst | 96 ++++ 3 files changed, 532 insertions(+), 63 deletions(-) create mode 100644 doc/users/prev_whats_new/github_stats_3.9.2.rst diff --git a/doc/users/github_stats.rst b/doc/users/github_stats.rst index d357a6759d30..914f59fc32c7 100644 --- a/doc/users/github_stats.rst +++ b/doc/users/github_stats.rst @@ -1,99 +1,472 @@ .. _github-stats: -GitHub statistics for 3.9.2 (Aug 12, 2024) -========================================== +GitHub statistics for 3.10.0rc1 (Oct 31, 2024) +============================================== -GitHub statistics for 2024/07/04 (tag: v3.9.1) - 2024/08/12 +GitHub statistics for 2024/05/15 (tag: v3.9.0) - 2024/10/31 These lists are automatically generated, and may be incomplete or contain duplicates. -We closed 9 issues and merged 45 pull requests. -The full list can be seen `on GitHub `__ +We closed 87 issues and merged 244 pull requests. +The full list can be seen `on GitHub `__ -The following 20 authors contributed 67 commits. +The following 116 authors contributed 1650 commits. +* abhi-jha * Adam J. Stewart +* Aditi Gautam +* Aditya Vidyadhar Kamath +* Alan +* Alan Sosa +* Alice +* Aman Nijjar +* Ammar Qazi +* Ancheng +* anpaulan +* Anson0028 * Anthony Lee +* anTon +* Antony Lee +* Ayoub Gouasmi +* Brigitta Sipőcz * Caitlin Hathaway +* cesar +* Charlie LeWarne +* Christian Mattsson * ClarkeAC +* Clement Gilli +* cmp0xff +* Costa Paraskevopoulos +* dale +* Dani Pinyol +* David Bakaj +* David Lowry-Duda +* David Meyer +* David Stansby +* dbakaj * dependabot[bot] +* Diogo Cardoso +* Doron Behar +* Edgar Andrés Margffoy Tuay * Elliott Sales de Andrade +* Eytan Adler +* farquh +* Felipe Cybis Pereira * Filippo Balzaretti +* FMasson +* Gavin S * Greg Lucas +* haaris * hannah * Ian Thomas +* Illviljan +* James Addison +* James Spencer * Jody Klymak +* john +* Jonas Eschle +* Jouni K. Seppänen +* juanis2112 +* Juanita Gomez +* Justin Hendrick +* K900 +* Kaustbh +* Kaustubh +* Kherim Willems * Kyle Sunden +* Kyra Cho +* Lorenzo +* Lumberbot (aka Jack) +* MadPhysicist +* malhar2460 +* Martino Sorbaro +* Mathias Hauser +* Matthew Feickert +* Matthew Petroff +* Melissa Weber Mendonça +* Michael +* Michael Droettboom +* Michael Hinton +* MischaMegens2 +* Moritz Wolter +* muchojp +* Nabil +* nakamura yuki +* odile +* OdileVidrine * Oscar Gustafsson +* Panicks28 +* Paul An +* Pedro Barão +* PedroBittarBarao +* Peter Talley +* Pierre-antoine Comby +* Pranav +* Pranav Raghu +* pre-commit-ci[bot] +* r3kste * Randolf Scholz * Refael Ackermann +* RickyP24 +* rnhmjoj * Ruth Comer +* saranti +* scaccol * Scott Shambaugh * Sean Smith +* Simon May +* simond07 +* smcgrawDotNet +* Takumasa N +* Takumasa N. +* Takumasa Nakamura +* thiagoluisbecker * Thomas A Caswell +* Tiago Lubiana * Tim Hoffmann +* trananso +* Trygve Magnus Ræder +* vittoboa +* Xeniya Shoiko GitHub issues and pull requests: -Pull Requests (45): +Pull Requests (244): -* :ghpull:`28687`: BLD: Include MSVCP140 runtime statically -* :ghpull:`28679`: Run delvewheel with path to required msvcp140.dll -* :ghpull:`28695`: Backport PR #27797 on branch v3.9.x (DOC: Use video files for saving animations) -* :ghpull:`28688`: Backport PR #28293 and #28668: Enable 3.13 wheels and bump cibuildwheel -* :ghpull:`27797`: DOC: Use video files for saving animations -* :ghpull:`28692`: Backport PR #28632 on branch v3.9.x (DOC: Tell sphinx-gallery to link mpl_toolkits from our build) -* :ghpull:`28632`: DOC: Tell sphinx-gallery to link mpl_toolkits from our build -* :ghpull:`28668`: Bump the actions group with 2 updates -* :ghpull:`28686`: Backport PR #28682 on branch v3.9.x (Fix warnings from mingw compilers) -* :ghpull:`28682`: Fix warnings from mingw compilers -* :ghpull:`28676`: Backport PR #28577 on branch v3.9.x (Copy all internals from initial Tick to lazy ones) -* :ghpull:`28577`: Copy all internals from initial Tick to lazy ones -* :ghpull:`28674`: Backport PR #28650 on branch v3.9.x (remove out of date todos on animation.py) -* :ghpull:`28650`: remove out of date todos on animation.py -* :ghpull:`28656`: Backport PR #28649 on branch v3.9.x (FIX: improve formatting of image values in cases of singular norms) -* :ghpull:`28665`: Backport PR #28546 on branch v3.9.x (DOC: Clarify/simplify example of multiple images with one colorbar) -* :ghpull:`28649`: FIX: improve formatting of image values in cases of singular norms -* :ghpull:`28635`: BLD: windows wheels -* :ghpull:`28645`: Backport PR #28644 on branch v3.9.x (DOC: Fix matching for version switcher) -* :ghpull:`28640`: Backport PR #28634 on branch v3.9.x (Closed open div tag in color.ColorMap._repr_html_) -* :ghpull:`28634`: Closed open div tag in color.ColorMap._repr_html_ -* :ghpull:`28636`: Backport PR #28625 on branch v3.9.x (added typing_extensions.Self to _AxesBase.twinx) -* :ghpull:`28625`: added typing_extensions.Self to _AxesBase.twinx -* :ghpull:`28622`: Backport PR #28621 on branch v3.9.x (TYP: Fix a typo in animation.pyi) -* :ghpull:`28621`: TYP: Fix a typo in animation.pyi -* :ghpull:`28605`: Backport PR #28604 on branch v3.9.x (cycler signature update.) -* :ghpull:`28604`: cycler signature update. -* :ghpull:`28598`: Pin PyQt6 back on Ubuntu 20.04 -* :ghpull:`28596`: Backport PR #28518 on branch v3.9.x ([TYP] Fix overload of ``pyplot.subplots``) -* :ghpull:`28518`: [TYP] Fix overload of ``pyplot.subplots`` -* :ghpull:`28591`: Backport PR #28580 on branch v3.9.x (Bump actions/attest-build-provenance from 1.3.2 to 1.3.3 in the actions group) -* :ghpull:`28580`: Bump actions/attest-build-provenance from 1.3.2 to 1.3.3 in the actions group -* :ghpull:`28586`: Backport PR #28582 on branch v3.9.x (FIX: make sticky edge tolerance relative to data range) -* :ghpull:`28582`: FIX: make sticky edge tolerance relative to data range -* :ghpull:`28572`: Backport PR #28571 on branch v3.9.x (DOC: Add version directive to hatch parameter in stackplot) -* :ghpull:`28571`: DOC: Add version directive to hatch parameter in stackplot -* :ghpull:`28564`: Backport PR #28534 on branch v3.9.x ([BLD] Fix WSL build warning) -* :ghpull:`28563`: Backport PR #28526 on branch v3.9.x (Bump pypa/cibuildwheel from 2.19.1 to 2.19.2 in the actions group) -* :ghpull:`28534`: [BLD] Fix WSL build warning -* :ghpull:`28526`: Bump pypa/cibuildwheel from 2.19.1 to 2.19.2 in the actions group -* :ghpull:`28552`: Backport PR #28541 on branch v3.9.x (MNT: be more careful about disk I/O failures when writing font cache) -* :ghpull:`28541`: MNT: be more careful about disk I/O failures when writing font cache -* :ghpull:`28524`: Backport PR #28523 on branch v3.9.x (Fix value error when set widget size to zero while using FigureCanvasQT ) -* :ghpull:`28523`: Fix value error when set widget size to zero while using FigureCanvasQT -* :ghpull:`28519`: Backport PR #28517 on branch v3.9.x (DOC: better cross referencing for animations) +* :ghpull:`29059`: Cleanup converter docs and StrCategoryConverter behavior +* :ghpull:`29058`: [DOC] Update missing-references.json +* :ghpull:`29057`: DOC/TST: lock numpy<2.1 in environment.yml +* :ghpull:`29053`: Factor out common formats strings in LogFormatter, LogFormatterExponent. +* :ghpull:`28970`: Add explicit converter setting to Axis +* :ghpull:`28048`: Enables setting hatch linewidth in Patches and Collections, also fixes setting hatch linewidth by rcParams +* :ghpull:`29017`: DOC: Document preferred figure size for examples +* :ghpull:`28871`: updated contribution doc #28476 +* :ghpull:`28453`: Stop relying on dead-reckoning mouse buttons for motion_notify_event. +* :ghpull:`28495`: ticker.EngFormatter: allow offset +* :ghpull:`29039`: MNT: Add provisional get_backend(resolve=False) flag +* :ghpull:`28946`: MNT: Deprecate plt.polar() with an existing non-polar Axes +* :ghpull:`29013`: FIX: auto_fmtxdate for constrained layout +* :ghpull:`29022`: Fixes AIX internal CI build break. +* :ghpull:`28830`: Feature: Support passing DataFrames to table.table +* :ghpull:`27766`: Return filename from save_figure +* :ghpull:`27167`: ENH: add long_axis property to colorbar +* :ghpull:`29021`: Update minimum pybind11 to 2.13.2 +* :ghpull:`28863`: Improved documentation for quiver +* :ghpull:`29019`: Update requirements to add PyStemmer to doc-requirements and environment +* :ghpull:`28653`: Mnt/generalize plot varargs +* :ghpull:`28967`: Fix MSVC cast warnings +* :ghpull:`29016`: DOC: Better explain suptitle / supxlabel / supylabel naming +* :ghpull:`28842`: FT2Font extension improvements +* :ghpull:`28658`: New data → color pipeline +* :ghpull:`29012`: Bump required pybind11 to 2.13 +* :ghpull:`29007`: MNT: Deprecate changing Figure.number +* :ghpull:`28861`: Break Artist._remove_method reference cycle +* :ghpull:`28478`: bugfix for ``PathSimplifier`` +* :ghpull:`28992`: DOC: Refresh transform tree example +* :ghpull:`28890`: MNT: Add missing dependency to environment.yml +* :ghpull:`28354`: Add Quiverkey zorder option +* :ghpull:`28966`: Fix polar error bar cap orientation +* :ghpull:`28819`: Mark all extensions as free-threading safe +* :ghpull:`28986`: DOC: Add tags for 3D fill_between examples +* :ghpull:`28984`: DOC / BUG: Better example for 3D axlim_clip argument +* :ghpull:`20866`: Remove ttconv and implement Type-42 embedding using fontTools +* :ghpull:`28975`: Set guiEvent where applicable for gtk4. +* :ghpull:`28568`: added tags to mplot3d examples +* :ghpull:`28976`: Bump pypa/cibuildwheel from 2.21.2 to 2.21.3 in the actions group +* :ghpull:`28978`: CI: Resolve mypy stubtest build errors +* :ghpull:`28823`: Fix 3D rotation precession +* :ghpull:`28841`: Make mplot3d mouse rotation style adjustable +* :ghpull:`28971`: DOC: correct linestyle example and reference rcParams +* :ghpull:`28702`: [MNT]: #28701 separate the generation of polygon vertices in fill_between to enable resampling +* :ghpull:`28965`: Suggest imageio_ffmpeg to provide ffmpeg as animation writer. +* :ghpull:`28964`: FIX macos: Use the agg buffer_rgba rather than private attribute +* :ghpull:`28963`: Remove refs to outdated writers in animation.py. +* :ghpull:`28948`: Raise ValueError for RGB values outside the [0, 1] range in rgb_to_hsv function +* :ghpull:`28857`: Pybind11 cleanup +* :ghpull:`28949`: [pre-commit.ci] pre-commit autoupdate +* :ghpull:`28950`: Bump the actions group with 2 updates +* :ghpull:`28904`: Agg: Remove 16-bit limits +* :ghpull:`28856`: Convert remaining code to pybind11 +* :ghpull:`28874`: Remove remaining 3.8 deprecations +* :ghpull:`28943`: DOC: Clarify the returned line of axhline()/axvline() +* :ghpull:`28935`: DOC: Fix invalid rcParam references +* :ghpull:`28942`: In colorbar docs, add ref from 'boundaries' doc to 'spacing' doc. +* :ghpull:`28933`: Switch AxLine.set_xy{1,2} to take a single argument. +* :ghpull:`28869`: ci: Bump build image on AppVeyor to MSVC 2019 +* :ghpull:`28906`: Re-fix exception caching in dviread. +* :ghpull:`27349`: [ENH] Implement dynamic clipping to axes limits for 3D plots +* :ghpull:`28913`: DOC: Fix Axis.set_label reference +* :ghpull:`28911`: MNT: Fix double evaluation of _LazyTickList +* :ghpull:`28584`: MNT: Prevent users from erroneously using legend label API on Axis +* :ghpull:`28853`: MNT: Check the input sizes of regular X,Y in pcolorfast +* :ghpull:`28838`: TST: Fix minor issues in interactive backend test +* :ghpull:`28795`: MNT: Cleanup docstring substitution mechanisms +* :ghpull:`28897`: Fix minor issues in stubtest wrapper +* :ghpull:`28899`: Don't cache exception with traceback reference loop in dviread. +* :ghpull:`28888`: DOC: Better visualization for the default color cycle example +* :ghpull:`28896`: doc: specify non-python dependencies in dev install docs +* :ghpull:`28843`: MNT: Cleanup FontProperties __init__ API +* :ghpull:`28683`: MNT: Warn if fixed aspect overwrites explicitly set data limits +* :ghpull:`25645`: Fix issue with sketch not working on PathCollection in Agg +* :ghpull:`28886`: DOC: Cross-link Axes attributes +* :ghpull:`28880`: Remove 'in' from removal substitution for deprecation messages +* :ghpull:`28875`: DOC: Fix documentation of hist() kwarg lists +* :ghpull:`28825`: DOC: Fix non-working code object references +* :ghpull:`28862`: Improve pie chart error messages +* :ghpull:`28844`: DOC: Add illustration to Figure.subplots_adjust +* :ghpull:`28588`: Fix scaling in Tk on non-Windows systems +* :ghpull:`28849`: DOC: Mark subfigures as no longer provisional +* :ghpull:`26000`: making onselect a keyword argument on selectors +* :ghpull:`26013`: Support unhashable callbacks in CallbackRegistry +* :ghpull:`27011`: Convert Agg extension to pybind11 +* :ghpull:`28845`: In examples, prefer named locations rather than location numbers. +* :ghpull:`27218`: API: finish LocationEvent.lastevent removal +* :ghpull:`26870`: Removed the deprecated code from axis.py +* :ghpull:`27996`: Create ``InsetIndicator`` artist +* :ghpull:`28532`: TYP: Fix xycoords and friends +* :ghpull:`28785`: Convert ft2font extension to pybind11 +* :ghpull:`28815`: DOC: Document policy on colormaps and styles +* :ghpull:`28826`: MNT: Replace _docstring.dedent_interpd by its alias _docstring.interpd +* :ghpull:`27567`: DOC: batch of tags +* :ghpull:`27302`: Tags for simple_scatter.py demo +* :ghpull:`28820`: DOC: Fix missing cross-reference checks for sphinx-tags +* :ghpull:`28786`: Handle single color in ContourSet +* :ghpull:`28808`: DOC: Add a plot to margins() to visualize the effect +* :ghpull:`27938`: feat: add dunder method for math operations on Axes Size divider +* :ghpull:`28569`: Adding tags to many examples +* :ghpull:`28183`: Expire deprecations +* :ghpull:`28801`: DOC: Clarify AxLine.set_xy2 / AxLine.set_slope +* :ghpull:`28788`: TST: Skip webp tests if it isn't available +* :ghpull:`28550`: Remove internal use of ``Artist.figure`` +* :ghpull:`28767`: MNT: expire ``ContourSet`` deprecations +* :ghpull:`28755`: TYP: Add typing for internal _tri extension +* :ghpull:`28765`: Add tests for most of FT2Font, and fix some bugs +* :ghpull:`28781`: TST: Fix test_pickle_load_from_subprocess in a dirty tree +* :ghpull:`28783`: Fix places where "auto" was not listed as valid interpolation_stage. +* :ghpull:`28779`: DOC/TST: lock numpy < 2.1 +* :ghpull:`28771`: Ensure SketchParams is always fully initialized +* :ghpull:`28375`: FIX: Made AffineDeltaTransform pass-through properly +* :ghpull:`28454`: MultivarColormap and BivarColormap +* :ghpull:`27891`: Refactor some parts of ft2font extension +* :ghpull:`28752`: quick fix dev build by locking out numpy version that's breaking things +* :ghpull:`28749`: Add sphinxcontrib-video to environment.yml +* :ghpull:`27851`: Add ten-color accessible color cycle as style sheet +* :ghpull:`28501`: ConciseDateFormatter's offset string is correct on an inverted axis +* :ghpull:`28734`: Compressed layout moves suptitle +* :ghpull:`28736`: Simplify some code in dviread +* :ghpull:`28347`: Doc: added triage section to new contributor docs +* :ghpull:`28735`: ci: Avoid setuptools 72.2.0 when installing kiwi on PyPy +* :ghpull:`28728`: MNT: Deprecate reimported functions in top-level namespace +* :ghpull:`28730`: MNT: Don't rely on RcParams being a dict subclass in internal code +* :ghpull:`28714`: Simplify _api.warn_external on Python 3.12+ +* :ghpull:`28727`: MNT: Better workaround for format_cursor_data on ScalarMappables +* :ghpull:`28725`: Stop disabling FH4 Exception Handling on MSVC +* :ghpull:`28711`: Merge branch v3.9.x into main +* :ghpull:`28713`: DOC: Add a few more notes to release guide +* :ghpull:`28720`: DOC: Clarify axhline() uses axes coordinates +* :ghpull:`28718`: DOC: Update missing references for numpydoc 1.8.0 +* :ghpull:`28710`: DOC: clarify alpha handling for indicate_inset[_zoom] +* :ghpull:`28704`: Fixed arrowstyle doc interpolation in FancyPatch.set_arrow() #28698. +* :ghpull:`28709`: Bump actions/attest-build-provenance from 1.4.0 to 1.4.1 in the actions group +* :ghpull:`28707`: Avoid division-by-zero in Sketch::Sketch +* :ghpull:`28610`: CI: Add CI to test matplotlib against free-threaded Python +* :ghpull:`28262`: Fix PolygonSelector cursor to temporarily hide during active zoom/pan +* :ghpull:`28670`: API: deprecate unused helper in patch._Styles +* :ghpull:`28589`: Qt embedding example: Separate drawing and data retrieval timers +* :ghpull:`28655`: Inline annotation and PGF user demos +* :ghpull:`28654`: DOC: Remove long uninstructive examples +* :ghpull:`28652`: Fix docstring style inconsistencies in lines.py +* :ghpull:`28641`: DOC: Standardize example titles - part 2 +* :ghpull:`28642`: DOC: Simplify heatmap example +* :ghpull:`28638`: DOC: Remove hint on PRs from origin/main +* :ghpull:`28587`: Added dark-mode diverging colormaps +* :ghpull:`28546`: DOC: Clarify/simplify example of multiple images with one colorbar +* :ghpull:`28613`: Added documentation for parameters vmin and vmax inside specgram function. +* :ghpull:`28627`: DOC: Bump minimum Sphinx to 5.1.0 +* :ghpull:`28628`: DOC: Sub-structure next API changes overview +* :ghpull:`28629`: FIX: ``Axis.set_in_layout`` respected +* :ghpull:`28575`: Add branch tracking to development workflow instructions +* :ghpull:`28616`: CI: Build docs on latest Python +* :ghpull:`28617`: DOC: Enable parallel builds +* :ghpull:`28544`: DOC: Standardize example titles +* :ghpull:`28615`: DOC: hack to suppress sphinx-gallery 17.0 warning +* :ghpull:`28293`: BLD: Enable building Python 3.13 wheels for nightlies +* :ghpull:`27385`: Fix 3D lines being visible when behind camera +* :ghpull:`28609`: svg: Ensure marker-only lines get URLs +* :ghpull:`28599`: Upgrade code to Python 3.10 +* :ghpull:`28593`: Update ruff to 0.2.0 +* :ghpull:`28603`: Simplify ttconv python<->C++ conversion using std::optional. +* :ghpull:`28557`: DOC: apply toc styling to remove nesting +* :ghpull:`28542`: CI: adjust pins in mypy GHA job +* :ghpull:`28504`: Changes in SVG backend to improve compatibility with Affinity designer +* :ghpull:`28122`: Disable clipping in Agg resamplers. +* :ghpull:`28597`: Pin PyQt6 back on Ubuntu 20.04 +* :ghpull:`28073`: Add support for multiple hatches, edgecolors and linewidths in histograms +* :ghpull:`28594`: MNT: Raise on GeoAxes limits manipulation +* :ghpull:`28312`: Remove one indirection layer in ToolSetCursor. +* :ghpull:`28573`: ENH: include property name in artist AttributeError +* :ghpull:`28503`: Bump minimum Python to 3.10 +* :ghpull:`28525`: FIX: colorbar pad for ``ImageGrid`` +* :ghpull:`28558`: DOC: Change _make_image signature to numpydoc +* :ghpull:`28061`: API: add antialiased to interpolation-stage in image +* :ghpull:`28536`: [svg] Add rcParam["svg.id"] to add a top-level id attribute to +* :ghpull:`28540`: Subfigures become stale when their artists are stale +* :ghpull:`28177`: Rationalise artist get_figure methods; make figure attribute a property +* :ghpull:`28527`: DOC: improve tagging guidelines page +* :ghpull:`28530`: DOC: Simplify axhspan example +* :ghpull:`28537`: DOC: Update timeline example for newer releases +* :ghpull:`27833`: [SVG] Introduce sequential ID-generation scheme for clip-paths. +* :ghpull:`28512`: DOC: Fix version switcher for stable docs +* :ghpull:`28492`: MNT: Remove PolyQuadMesh deprecations +* :ghpull:`28509`: CI: Use micromamba on AppVeyor +* :ghpull:`28510`: Merge v3.9.1 release into main +* :ghpull:`28494`: [pre-commit.ci] pre-commit autoupdate +* :ghpull:`28497`: Add words to ignore for codespell +* :ghpull:`28455`: Expand ticklabels_rotation example to cover rotating default ticklabels. +* :ghpull:`28282`: DOC: clarify no-build-isolation & mypy ignoring new functions +* :ghpull:`28306`: Fixed PolarAxes not using fmt_xdata and added simple test (#4568) +* :ghpull:`28400`: DOC: Improve doc wording of data parameter +* :ghpull:`28225`: [ENH]: fill_between extended to 3D +* :ghpull:`28371`: Bump pypa/cibuildwheel from 2.18.1 to 2.19.0 in the actions group +* :ghpull:`28390`: Inline RendererBase._get_text_path_transform. +* :ghpull:`28381`: Take hinting rcParam into account in MathTextParser cache. +* :ghpull:`28363`: flip subfigures axes to match subplots +* :ghpull:`28340`: Fix missing font error when using MiKTeX +* :ghpull:`28379`: PathEffectsRenderer can plainly inherit RendererBase._draw_text_as_path. +* :ghpull:`28275`: Revive sanitizing default filenames extracted from UI window titles +* :ghpull:`28360`: DOC: fixed code for testing check figures equal example +* :ghpull:`28370`: Reorder Axes3D parameters semantically. +* :ghpull:`28350`: Typo in communication guide: extensiblity -> extensibility +* :ghpull:`28290`: Introduce natural 3D rotation with mouse +* :ghpull:`28186`: apply unary minus spacing directly after equals sign +* :ghpull:`28311`: Update 3D orientation indication right away +* :ghpull:`28300`: Faster title alignment +* :ghpull:`28313`: Factor out handling of missing spines in alignment calculations. +* :ghpull:`28196`: TST: add timeouts to font_manager + threading test +* :ghpull:`28279`: Doc/ipython dep +* :ghpull:`28091`: [MNT]: create build-requirements.txt and update dev-requirements.txt +* :ghpull:`27992`: Add warning for multiple pyplot.figure calls with same ID +* :ghpull:`28238`: DOC: Update release guide to match current automations +* :ghpull:`28232`: Merge v3.9.0 release into main +* :ghpull:`28228`: DOC: Fix typo in release_guide.rst +* :ghpull:`28074`: Add ``orientation`` parameter to Boxplot and deprecate ``vert`` +* :ghpull:`27998`: Add a new ``orientation`` parameter to Violinplot and deprecate ``vert`` +* :ghpull:`28217`: Better group logging of font handling by texmanager. +* :ghpull:`28130`: Clarify the role of out_mask and out_alpha in _make_image. +* :ghpull:`28201`: Deprecate ``Poly3DCollection.get_vector`` +* :ghpull:`28046`: DOC: Clarify merge policy +* :ghpull:`26893`: PGF: Consistently set LaTeX document font size +* :ghpull:`28156`: Don't set savefig.facecolor/edgecolor in dark_background/538 styles. +* :ghpull:`28030`: Fix #28016: wrong lower ylim when baseline=None on stairs +* :ghpull:`28127`: GOV: write up policy on not updating req for CVEs in dependencies +* :ghpull:`28106`: Fix: [Bug]: Setting norm by string doesn't work for hexbin #28105 +* :ghpull:`28143`: Merge branch v3.9.x into main +* :ghpull:`28133`: Make ``functions`` param to secondary_x/yaxis not keyword-only. +* :ghpull:`28083`: Convert TensorFlow to numpy for plots +* :ghpull:`28116`: FIX: Correct names of aliased cmaps +* :ghpull:`28118`: Remove redundant baseline tests in test_image. +* :ghpull:`28093`: Minor maintenance on pgf docs/backends. +* :ghpull:`27818`: Set polygon offsets for log scaled hexbin +* :ghpull:`28058`: TYP: add float to to_rgba x type +* :ghpull:`27964`: BUG: Fix NonUniformImage with nonlinear scale +* :ghpull:`28054`: DOC: Clarify that parameters to gridded data plotting functions are p… +* :ghpull:`27882`: Deleting all images that have passed tests before upload +* :ghpull:`28033`: API: warn if stairs used in way that is likely not desired +* :ghpull:`27786`: Deprecate positional use of most arguments of plotting functions +* :ghpull:`28025`: DOC: Clarify interface terminology +* :ghpull:`28043`: MNT: Add git blame ignore for docstring parameter indentation fix +* :ghpull:`28037`: DOC: Fix inconsistent spacing in some docstrings in _axes.py +* :ghpull:`28031`: Be more specific in findobj return type -Issues (9): +Issues (87): -* :ghissue:`28551`: [Bug]: Possible issue with Matplotlib 3.9.1 wheel on Windows only -* :ghissue:`28250`: [Doc]: Sphinx gallery links mispointed for Axes3D methods -* :ghissue:`28574`: [Bug]: Nondeterministic behavior with subplot spacing and constrained layout -* :ghissue:`28626`: [Doc]: Remove old TODO's from animation.py -* :ghissue:`28648`: [Bug]: format_image_data on an image of only zeros produces a large number of zeros -* :ghissue:`28624`: [Bug]: Bad type hint in ``_AxesBase.twinx()`` -* :ghissue:`28567`: [Bug]: sticky edge related changes for datetime plots -* :ghissue:`28533`: [Doc]: Stackplot hatch functionality has version dependencies -* :ghissue:`28538`: [Bug]: Permission denied when importing matplotlib.pyplot +* :ghissue:`19229`: Add public API for setting an axis unit converter +* :ghissue:`21108`: [Bug]: Hatch linewidths cannot be modified in an rcParam context +* :ghissue:`27784`: [Bug]: Polar plot error bars don't rotate with angle for ``set_theta_direction`` and ``set_theta_offset`` +* :ghissue:`28944`: [Bug]: calling title before making polar plot +* :ghissue:`29011`: [Bug]: Figure.autofmt_xdate() not working in presence of colorbar with constrained layout +* :ghissue:`29020`: AIX internal CI build break #Matplotlib +* :ghissue:`28726`: feature request: support passing DataFrames to table.table +* :ghissue:`28570`: [MNT]: Try improving doc build speed by using PyStemmer +* :ghissue:`13388`: Typo in the figure API (fig.suptitle) +* :ghissue:`28994`: [Bug]: Figure Number Gives Type Error +* :ghissue:`28985`: [ENH]: Cannot disable coordinate display in ToolManager/Toolbar (it's doable in NavigationToolbar2) +* :ghissue:`17914`: ``PathSimplifier`` fails to ignore ``CLOSEPOLY`` vertices +* :ghissue:`28885`: [Bug]: Strange errorbar caps when polar axes have non-default theta direction or theta zero location +* :ghissue:`12418`: replace ttconv for ps/pdf +* :ghissue:`28962`: [Bug]: gtk4 backend does not set guiEvent attribute +* :ghissue:`28408`: [ENH]: mplot3d mouse rotation style +* :ghissue:`28701`: [MNT]: Separate the generation of polygon vertices from ``_fill_between_x_or_y`` +* :ghissue:`28941`: [Bug]: unexplicit error message when using ``matplotlib.colors.rgb_to_hsv()`` with wrong input +* :ghissue:`23846`: [MNT]: Pybind11 transition plan +* :ghissue:`28866`: Possible memory leak in pybind11 migration +* :ghissue:`26368`: [Bug]: Long audio files result in incomplete spectrogram visualizations +* :ghissue:`23826`: [Bug]: Overflow of 16-bit integer in Agg renderer causes PolyCollections to be drawn at incorrect locations +* :ghissue:`28927`: [Bug]: Enforce that Line data modifications are sequences +* :ghissue:`12312`: colorbar(boundaries=...) doesn't work so well with nonlinear norms +* :ghissue:`28800`: [ENH]: AxLine xy1/xy2 setters should take xy as single parameters, (possibly) not separate ones +* :ghissue:`28893`: [Bug]: Lines between points are invisible when there are more than 7 subfigures per row +* :ghissue:`28908`: [Bug]: Possible performance issue with _LazyTickList +* :ghissue:`27971`: [Bug]: ax.xaxis.set_label(...) doesn't set the x-axis label +* :ghissue:`28059`: [Bug]: pcolorfast should validate that regularly spaced X or Y inputs have the right size +* :ghissue:`28892`: [Doc]: Be more specific on dependencies that need to be installed for a "reasonable" dev environment +* :ghissue:`19693`: path.sketch doesn't apply to PolyCollection +* :ghissue:`28873`: [Bug]: hist()'s doc for edgecolors/facecolors does not match behavior (which is itself not very consistent) +* :ghissue:`23005`: [Doc]: Add figure to ``subplots_adjust`` +* :ghissue:`25947`: [Doc]: Subfigures still marked as provisional +* :ghissue:`26012`: [Bug]: "Unhashable type" when event callback is a method of a ``dict`` subclass +* :ghissue:`23425`: [Bug]: Axes.indicate_inset connectors affect constrained layout +* :ghissue:`23424`: [Bug]: Axes.indicate_inset(linewidth=...) doesn't affect connectors +* :ghissue:`19768`: Overlay created by ``Axes.indicate_inset_zoom`` does not adjust when changing inset ranges +* :ghissue:`27673`: [Doc]: Confusing page on color changes +* :ghissue:`28782`: [Bug]: String ``contour(colors)`` gives confusing error when ``extend`` used +* :ghissue:`27930`: [ENH]: Make axes_grid1.Size more math friendly. +* :ghissue:`28372`: [Bug]: AffineDeltaTransform does not appear to invalidate properly +* :ghissue:`27866`: [Bug]: Adding suptitle in compressed layout causes weird spacing +* :ghissue:`28731`: [Bug]: Plotting numpy.array of dtype float32 with pyplot.imshow and specified colors.LogNorm produces wrong colors +* :ghissue:`28715`: [Bug]: CI doc builds fail since a couple of days +* :ghissue:`28698`: [bug]: arrowstyle doc interpolation in FancyPatch.set_arrow() +* :ghissue:`28669`: [Bug]: division-by-zero error in Sketch::Sketch with Agg backend +* :ghissue:`28548`: [Doc]: matplotlib.pyplot.specgram parameters vmin and vmax are not documented +* :ghissue:`28165`: [Bug]: PolygonSelector should hide itself when zoom/pan is active +* :ghissue:`18608`: Feature proposal: "Dark mode" divergent colormaps +* :ghissue:`28623`: [Bug]: ``Axis.set_in_layout`` not respected? +* :ghissue:`6305`: Matplotlib 3D plot - parametric curve “wraparound” from certain perspectives +* :ghissue:`28595`: [Bug]: set_url without effect for instances of Line2D with linestyle 'none' +* :ghissue:`20910`: [Bug]: Exported SVG files are no longer imported Affinity Designer correctly +* :ghissue:`28600`: [TST] Upcoming dependency test failures +* :ghissue:`26718`: [Bug]: stacked histogram does not properly handle edgecolor and hatches +* :ghissue:`28590`: [ENH]: Geo Projections support for inverting axis +* :ghissue:`27954`: [ENH]: Iterables in grouped histogram labels +* :ghissue:`27878`: [ENH]: AttributeError('... got an unexpected keyword argument ...') should set the .name attribute to the keyword +* :ghissue:`28489`: [TST] Upcoming dependency test failures +* :ghissue:`28343`: [Bug]: inconsistent colorbar pad for ``ImageGrid`` with ``cbar_mode="single"`` +* :ghissue:`28535`: [ENH]: Add id attribute to top level svg tag +* :ghissue:`28170`: [Doc]: ``get_figure`` may return a ``SubFigure`` +* :ghissue:`27831`: [Bug]: Nondeterminism in SVG clipPath element id attributes +* :ghissue:`4568`: Add ``fmt_r`` and ``fmt_theta`` methods to polar axes +* :ghissue:`28105`: [Bug]: Setting norm by string doesn't work for hexbin +* :ghissue:`28142`: [ENH]: Add fill between support for 3D plots +* :ghissue:`28344`: [Bug]: subfigures are added in column major order +* :ghissue:`28212`: [Bug]: Matplotlib not work with MiKTeX. +* :ghissue:`28288`: [ENH]: Natural 3D rotation with mouse +* :ghissue:`28180`: [Bug]: mathtext should distinguish between unary and binary minus +* :ghissue:`26150`: [Bug]: Savefig slow with subplots +* :ghissue:`28310`: [Bug]: orientation indication shows up late in mplot3d, and then lingers +* :ghissue:`16263`: Apply NEP29 (time-limited support) to IPython +* :ghissue:`28192`: [MNT]: Essential build requirements not included in dev-requirements +* :ghissue:`27978`: [Bug]: strange behaviour when redefining figure size +* :ghissue:`13435`: boxplot/violinplot orientation-setting API +* :ghissue:`28199`: [MNT]: Misleading function name ``Poly3DCollection.get_vector()`` +* :ghissue:`26892`: [Bug]: PGF font size mismatch between measurement and output +* :ghissue:`28016`: [Bug]: Unexpected ylim of stairs with baseline=None +* :ghissue:`28114`: [Bug]: mpl.colormaps[ "Grays" ].name is "Greys", not "Grays" +* :ghissue:`18045`: Cannot access hexbin data when ``xscale='log'`` and ``yscale='log'`` are set. +* :ghissue:`27820`: [Bug]: Logscale Axis + NonUniformImage + GUI move tool = Distortion +* :ghissue:`28047`: [Bug]: plt.barbs is a command that cannot be passed in a c parameter by parameter name, but can be passed in the form of a positional parameter +* :ghissue:`23400`: Only upload failed images on failure +* :ghissue:`26752`: [Bug]: ``ax.stairs()`` creates inaccurate ``fill`` for the plot +* :ghissue:`21817`: [Doc/Dev]: style guide claims "object oriented" is verboten. Previous GitHub statistics diff --git a/doc/users/prev_whats_new/github_stats_3.9.0.rst b/doc/users/prev_whats_new/github_stats_3.9.0.rst index b1d229ffbfa1..5ddbdfd6f2bd 100644 --- a/doc/users/prev_whats_new/github_stats_3.9.0.rst +++ b/doc/users/prev_whats_new/github_stats_3.9.0.rst @@ -1,4 +1,4 @@ -.. _github-stats-3-9.0: +.. _github-stats-3-9-0: GitHub statistics for 3.9.0 (May 15, 2024) ========================================== diff --git a/doc/users/prev_whats_new/github_stats_3.9.2.rst b/doc/users/prev_whats_new/github_stats_3.9.2.rst new file mode 100644 index 000000000000..542e0d81ce32 --- /dev/null +++ b/doc/users/prev_whats_new/github_stats_3.9.2.rst @@ -0,0 +1,96 @@ +.. _github-stats-3-9-2: + +GitHub statistics for 3.9.2 (Aug 12, 2024) +========================================== + +GitHub statistics for 2024/07/04 (tag: v3.9.1) - 2024/08/12 + +These lists are automatically generated, and may be incomplete or contain duplicates. + +We closed 9 issues and merged 45 pull requests. +The full list can be seen `on GitHub `__ + +The following 20 authors contributed 67 commits. + +* Adam J. Stewart +* Anthony Lee +* Caitlin Hathaway +* ClarkeAC +* dependabot[bot] +* Elliott Sales de Andrade +* Filippo Balzaretti +* Greg Lucas +* hannah +* Ian Thomas +* Jody Klymak +* Kyle Sunden +* Oscar Gustafsson +* Randolf Scholz +* Refael Ackermann +* Ruth Comer +* Scott Shambaugh +* Sean Smith +* Thomas A Caswell +* Tim Hoffmann + +GitHub issues and pull requests: + +Pull Requests (45): + +* :ghpull:`28687`: BLD: Include MSVCP140 runtime statically +* :ghpull:`28679`: Run delvewheel with path to required msvcp140.dll +* :ghpull:`28695`: Backport PR #27797 on branch v3.9.x (DOC: Use video files for saving animations) +* :ghpull:`28688`: Backport PR #28293 and #28668: Enable 3.13 wheels and bump cibuildwheel +* :ghpull:`27797`: DOC: Use video files for saving animations +* :ghpull:`28692`: Backport PR #28632 on branch v3.9.x (DOC: Tell sphinx-gallery to link mpl_toolkits from our build) +* :ghpull:`28632`: DOC: Tell sphinx-gallery to link mpl_toolkits from our build +* :ghpull:`28668`: Bump the actions group with 2 updates +* :ghpull:`28686`: Backport PR #28682 on branch v3.9.x (Fix warnings from mingw compilers) +* :ghpull:`28682`: Fix warnings from mingw compilers +* :ghpull:`28676`: Backport PR #28577 on branch v3.9.x (Copy all internals from initial Tick to lazy ones) +* :ghpull:`28577`: Copy all internals from initial Tick to lazy ones +* :ghpull:`28674`: Backport PR #28650 on branch v3.9.x (remove out of date todos on animation.py) +* :ghpull:`28650`: remove out of date todos on animation.py +* :ghpull:`28656`: Backport PR #28649 on branch v3.9.x (FIX: improve formatting of image values in cases of singular norms) +* :ghpull:`28665`: Backport PR #28546 on branch v3.9.x (DOC: Clarify/simplify example of multiple images with one colorbar) +* :ghpull:`28649`: FIX: improve formatting of image values in cases of singular norms +* :ghpull:`28635`: BLD: windows wheels +* :ghpull:`28645`: Backport PR #28644 on branch v3.9.x (DOC: Fix matching for version switcher) +* :ghpull:`28640`: Backport PR #28634 on branch v3.9.x (Closed open div tag in color.ColorMap._repr_html_) +* :ghpull:`28634`: Closed open div tag in color.ColorMap._repr_html_ +* :ghpull:`28636`: Backport PR #28625 on branch v3.9.x (added typing_extensions.Self to _AxesBase.twinx) +* :ghpull:`28625`: added typing_extensions.Self to _AxesBase.twinx +* :ghpull:`28622`: Backport PR #28621 on branch v3.9.x (TYP: Fix a typo in animation.pyi) +* :ghpull:`28621`: TYP: Fix a typo in animation.pyi +* :ghpull:`28605`: Backport PR #28604 on branch v3.9.x (cycler signature update.) +* :ghpull:`28604`: cycler signature update. +* :ghpull:`28598`: Pin PyQt6 back on Ubuntu 20.04 +* :ghpull:`28596`: Backport PR #28518 on branch v3.9.x ([TYP] Fix overload of ``pyplot.subplots``) +* :ghpull:`28518`: [TYP] Fix overload of ``pyplot.subplots`` +* :ghpull:`28591`: Backport PR #28580 on branch v3.9.x (Bump actions/attest-build-provenance from 1.3.2 to 1.3.3 in the actions group) +* :ghpull:`28580`: Bump actions/attest-build-provenance from 1.3.2 to 1.3.3 in the actions group +* :ghpull:`28586`: Backport PR #28582 on branch v3.9.x (FIX: make sticky edge tolerance relative to data range) +* :ghpull:`28582`: FIX: make sticky edge tolerance relative to data range +* :ghpull:`28572`: Backport PR #28571 on branch v3.9.x (DOC: Add version directive to hatch parameter in stackplot) +* :ghpull:`28571`: DOC: Add version directive to hatch parameter in stackplot +* :ghpull:`28564`: Backport PR #28534 on branch v3.9.x ([BLD] Fix WSL build warning) +* :ghpull:`28563`: Backport PR #28526 on branch v3.9.x (Bump pypa/cibuildwheel from 2.19.1 to 2.19.2 in the actions group) +* :ghpull:`28534`: [BLD] Fix WSL build warning +* :ghpull:`28526`: Bump pypa/cibuildwheel from 2.19.1 to 2.19.2 in the actions group +* :ghpull:`28552`: Backport PR #28541 on branch v3.9.x (MNT: be more careful about disk I/O failures when writing font cache) +* :ghpull:`28541`: MNT: be more careful about disk I/O failures when writing font cache +* :ghpull:`28524`: Backport PR #28523 on branch v3.9.x (Fix value error when set widget size to zero while using FigureCanvasQT ) +* :ghpull:`28523`: Fix value error when set widget size to zero while using FigureCanvasQT +* :ghpull:`28519`: Backport PR #28517 on branch v3.9.x (DOC: better cross referencing for animations) + +Issues (9): + +* :ghissue:`28551`: [Bug]: Possible issue with Matplotlib 3.9.1 wheel on Windows only +* :ghissue:`28250`: [Doc]: Sphinx gallery links mispointed for Axes3D methods +* :ghissue:`28574`: [Bug]: Nondeterministic behavior with subplot spacing and constrained layout +* :ghissue:`28626`: [Doc]: Remove old TODO's from animation.py +* :ghissue:`28648`: [Bug]: format_image_data on an image of only zeros produces a large number of zeros +* :ghissue:`28624`: [Bug]: Bad type hint in ``_AxesBase.twinx()`` +* :ghissue:`28567`: [Bug]: sticky edge related changes for datetime plots +* :ghissue:`28533`: [Doc]: Stackplot hatch functionality has version dependencies +* :ghissue:`28538`: [Bug]: Permission denied when importing matplotlib.pyplot From c24ea66fc140e90d8d6297f5f93c4db9b4f51d8e Mon Sep 17 00:00:00 2001 From: Kyle Sunden Date: Thu, 31 Oct 2024 21:03:07 -0500 Subject: [PATCH 040/131] Matplotlib v3.10.0rc1 From 0e4467039f1504f154d3ab8aedafa8c67a126819 Mon Sep 17 00:00:00 2001 From: Kyle Sunden Date: Thu, 31 Oct 2024 21:04:29 -0500 Subject: [PATCH 041/131] Bump from v3.10.0rc1 From d9d95282f0adc9333106c5c03d4fd4bf51f5a03b Mon Sep 17 00:00:00 2001 From: Thomas A Caswell Date: Fri, 1 Nov 2024 13:17:24 -0400 Subject: [PATCH 042/131] Backport PR #29024: Fix saving animations to transparent formats --- lib/matplotlib/animation.py | 57 ++++++++++++++++++++++++++++++------- 1 file changed, 47 insertions(+), 10 deletions(-) diff --git a/lib/matplotlib/animation.py b/lib/matplotlib/animation.py index a0236a6956cb..47f2f0f9515b 100644 --- a/lib/matplotlib/animation.py +++ b/lib/matplotlib/animation.py @@ -178,6 +178,14 @@ def frame_size(self): w, h = self.fig.get_size_inches() return int(w * self.dpi), int(h * self.dpi) + def _supports_transparency(self): + """ + Whether this writer supports transparency. + + Writers may consult output file type and codec to determine this at runtime. + """ + return False + @abc.abstractmethod def grab_frame(self, **savefig_kwargs): """ @@ -468,6 +476,9 @@ def finish(self): @writers.register('pillow') class PillowWriter(AbstractMovieWriter): + def _supports_transparency(self): + return True + @classmethod def isAvailable(cls): return True @@ -503,11 +514,26 @@ class FFMpegBase: _exec_key = 'animation.ffmpeg_path' _args_key = 'animation.ffmpeg_args' + def _supports_transparency(self): + suffix = Path(self.outfile).suffix + if suffix in {'.apng', '.avif', '.gif', '.webm', '.webp'}: + return True + # This list was found by going through `ffmpeg -codecs` for video encoders, + # running them with _support_transparency() forced to True, and checking that + # the "Pixel format" in Kdenlive included alpha. Note this is not a guarantee + # that transparency will work; you may also need to pass `-pix_fmt`, but we + # trust the user has done so if they are asking for these formats. + return self.codec in { + 'apng', 'avrp', 'bmp', 'cfhd', 'dpx', 'ffv1', 'ffvhuff', 'gif', 'huffyuv', + 'jpeg2000', 'ljpeg', 'png', 'prores', 'prores_aw', 'prores_ks', 'qtrle', + 'rawvideo', 'targa', 'tiff', 'utvideo', 'v408', } + @property def output_args(self): args = [] - if Path(self.outfile).suffix == '.gif': - self.codec = 'gif' + suffix = Path(self.outfile).suffix + if suffix in {'.apng', '.avif', '.gif', '.webm', '.webp'}: + self.codec = suffix[1:] else: args.extend(['-vcodec', self.codec]) extra_args = (self.extra_args if self.extra_args is not None @@ -518,11 +544,17 @@ def output_args(self): # macOS). Also fixes internet explorer. This is as of 2015/10/29. if self.codec == 'h264' and '-pix_fmt' not in extra_args: args.extend(['-pix_fmt', 'yuv420p']) - # For GIF, we're telling FFMPEG to split the video stream, to generate + # For GIF, we're telling FFmpeg to split the video stream, to generate # a palette, and then use it for encoding. elif self.codec == 'gif' and '-filter_complex' not in extra_args: args.extend(['-filter_complex', 'split [a][b];[a] palettegen [p];[b][p] paletteuse']) + # For AVIF, we're telling FFmpeg to split the video stream, extract the alpha, + # in order to place it in a secondary stream, as needed by AVIF-in-FFmpeg. + elif self.codec == 'avif' and '-filter_complex' not in extra_args: + args.extend(['-filter_complex', + 'split [rgb][rgba]; [rgba] alphaextract [alpha]', + '-map', '[rgb]', '-map', '[alpha]']) if self.bitrate > 0: args.extend(['-b', '%dk' % self.bitrate]) # %dk: bitrate in kbps. for k, v in self.metadata.items(): @@ -610,6 +642,10 @@ class ImageMagickBase: _exec_key = 'animation.convert_path' _args_key = 'animation.convert_args' + def _supports_transparency(self): + suffix = Path(self.outfile).suffix + return suffix in {'.apng', '.avif', '.gif', '.webm', '.webp'} + def _args(self): # ImageMagick does not recognize "raw". fmt = "rgba" if self.frame_format == "raw" else self.frame_format @@ -1045,22 +1081,23 @@ def func(current_frame: int, total_frames: int) -> Any # since GUI widgets are gone. Either need to remove extra code to # allow for this non-existent use case or find a way to make it work. - facecolor = savefig_kwargs.get('facecolor', - mpl.rcParams['savefig.facecolor']) - if facecolor == 'auto': - facecolor = self._fig.get_facecolor() - def _pre_composite_to_white(color): r, g, b, a = mcolors.to_rgba(color) return a * np.array([r, g, b]) + 1 - a - savefig_kwargs['facecolor'] = _pre_composite_to_white(facecolor) - savefig_kwargs['transparent'] = False # just to be safe! # canvas._is_saving = True makes the draw_event animation-starting # callback a no-op; canvas.manager = None prevents resizing the GUI # widget (both are likewise done in savefig()). with (writer.saving(self._fig, filename, dpi), cbook._setattr_cm(self._fig.canvas, _is_saving=True, manager=None)): + if not writer._supports_transparency(): + facecolor = savefig_kwargs.get('facecolor', + mpl.rcParams['savefig.facecolor']) + if facecolor == 'auto': + facecolor = self._fig.get_facecolor() + savefig_kwargs['facecolor'] = _pre_composite_to_white(facecolor) + savefig_kwargs['transparent'] = False # just to be safe! + for anim in all_anim: anim._init_draw() # Clear the initial frame frame_number = 0 From 68fdc8a24ce39b02e4754c679289a69e67351f09 Mon Sep 17 00:00:00 2001 From: Tim Hoffmann <2836374+timhoffm@users.noreply.github.com> Date: Mon, 4 Nov 2024 20:56:18 +0100 Subject: [PATCH 043/131] Backport PR #29068: [DOC] Fix indentation in sync_cmaps example --- galleries/examples/images_contours_and_fields/multi_image.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/galleries/examples/images_contours_and_fields/multi_image.py b/galleries/examples/images_contours_and_fields/multi_image.py index 8be048055dec..4e6f6cc54a79 100644 --- a/galleries/examples/images_contours_and_fields/multi_image.py +++ b/galleries/examples/images_contours_and_fields/multi_image.py @@ -63,8 +63,8 @@ # # def sync_cmaps(changed_image): # for im in images: -# if changed_image.get_cmap() != im.get_cmap(): -# im.set_cmap(changed_image.get_cmap()) +# if changed_image.get_cmap() != im.get_cmap(): +# im.set_cmap(changed_image.get_cmap()) # # for im in images: # im.callbacks.connect('changed', sync_cmaps) From 0fd143409d66f7ca71e3fb50ea4b299585b80551 Mon Sep 17 00:00:00 2001 From: Tim Hoffmann <2836374+timhoffm@users.noreply.github.com> Date: Mon, 4 Nov 2024 20:58:34 +0100 Subject: [PATCH 044/131] Backport PR #29048: DOC: integrated pr workflow from contributing guide into install and workflow --- doc/devel/contribute.rst | 116 +++-------------------------- doc/devel/development_setup.rst | 68 ++++++++++++++--- doc/devel/development_workflow.rst | 40 ++++++++-- doc/devel/pr_guide.rst | 2 + 4 files changed, 106 insertions(+), 120 deletions(-) diff --git a/doc/devel/contribute.rst b/doc/devel/contribute.rst index 5911cd860281..66057c76396f 100644 --- a/doc/devel/contribute.rst +++ b/doc/devel/contribute.rst @@ -319,113 +319,19 @@ Start a pull request The preferred way to contribute to Matplotlib is to fork the `main repository `__ on GitHub, -then submit a "pull request" (PR). You can do this by cloning a copy of the -Matplotlib repository to your own computer, or alternatively using -`GitHub Codespaces `_, a cloud-based -in-browser development environment that comes with the appropriate setup to -contribute to Matplotlib. +then submit a "pull request" (PR). To work on a a pull request: -Workflow overview ------------------ - -A brief overview of the workflow is as follows. - -#. `Create an account `_ on GitHub if you do not - already have one. - -#. Fork the `project repository `_ by - clicking on the :octicon:`repo-forked` **Fork** button near the top of the page. - This creates a copy of the code under your account on the GitHub server. - -#. Set up a development environment: - - .. tab-set:: - - .. tab-item:: Local development - - Clone this copy to your local disk:: - - git clone https://github.com//matplotlib.git - - .. tab-item:: Using GitHub Codespaces - - Check out the Matplotlib repository and activate your development environment: - - #. Open codespaces on your fork by clicking on the green "Code" button - on the GitHub web interface and selecting the "Codespaces" tab. - - #. Next, click on "Open codespaces on ". You will be - able to change branches later, so you can select the default - ``main`` branch. - - #. After the codespace is created, you will be taken to a new browser - tab where you can use the terminal to activate a pre-defined conda - environment called ``mpl-dev``:: - - conda activate mpl-dev - - -#. Install the local version of Matplotlib with:: - - python -m pip install --no-build-isolation --editable .[dev] - - See :ref:`installing_for_devs` for detailed instructions. - -#. Create a branch to hold your changes:: - - git checkout -b my-feature origin/main - - and start making changes. Never work in the ``main`` branch! - -#. Work on this task using Git to do the version control. Codespaces persist for - some time (check the `documentation for details - `_) - and can be managed on https://github.com/codespaces. When you're done editing - e.g., ``lib/matplotlib/collections.py``, do:: - - git add lib/matplotlib/collections.py - git commit -m 'a commit message' - - to record your changes in Git, then push them to your GitHub fork with:: - - git push -u origin my-feature - -GitHub Codespaces workflows -""""""""""""""""""""""""""" - -If you need to open a GUI window with Matplotlib output on Codespaces, our -configuration includes a `light-weight Fluxbox-based desktop -`_. -You can use it by connecting to this desktop via your web browser. To do this: - -#. Press ``F1`` or ``Ctrl/Cmd+Shift+P`` and select - ``Ports: Focus on Ports View`` in the VSCode session to bring it into - focus. Open the ports view in your tool, select the ``noVNC`` port, and - click the Globe icon. -#. In the browser that appears, click the Connect button and enter the desktop - password (``vscode`` by default). - -Check the `GitHub instructions -`_ -for more details on connecting to the desktop. - -View documentation -'''''''''''''''''' +#. **First** set up a development environment, either by cloning a copy of the + Matplotlib repository to your own computer or by using Github codespaces, by + following the instructions in :ref:`installing_for_devs` -If you also built the documentation pages, you can view them using Codespaces. -Use the "Extensions" icon in the activity bar to install the "Live Server" -extension. Locate the ``doc/build/html`` folder in the Explorer, right click -the file you want to open and select "Open with Live Server." +#. **Then** start a pull request by following the guidance in :ref:`development workflow ` -Open a pull request on Matplotlib ---------------------------------- +#. **After starting** check that your contribution meets the :ref:`pull request guidelines ` + and :ref:`update the pull request ` as needed. -Finally, go to the web page of *your fork* of the Matplotlib repo, and click -**Compare & pull request** to send your changes to the maintainers for review. -The base repository is ``matplotlib/matplotlib`` and the base branch is -generally ``main``. For more guidance, see GitHub's `pull request tutorial -`_. +#. **Finally** follow up with maintainers on the PR if waiting more than a few days for + feedback. -For more detailed instructions on how to set up Matplotlib for development and -best practices for contribution, see :ref:`installing_for_devs` and -:ref:`development-workflow`. +If you have questions of any sort, reach out on the :ref:`contributor_incubator` and join +the :ref:`new_contributors_meeting`. diff --git a/doc/devel/development_setup.rst b/doc/devel/development_setup.rst index acd004690e8b..cffda17939a7 100644 --- a/doc/devel/development_setup.rst +++ b/doc/devel/development_setup.rst @@ -28,11 +28,11 @@ Fork the Matplotlib repository Matplotlib is hosted at https://github.com/matplotlib/matplotlib.git. If you plan on solving issues or submitting pull requests to the main Matplotlib -repository, you should first *fork* this repository by visiting -https://github.com/matplotlib/matplotlib.git and clicking on the -``Fork`` :octicon:`repo-forked` button on the top right of the page. See -`the GitHub documentation `__ -for more details. +repository, you should first fork this repository by *clicking* the +:octicon:`repo-forked` **Fork** button near the top of the `project repository `_ page. + +This creates a copy of the code under your account on the GitHub server. See `the GitHub +documentation `__ for more details. Retrieve the latest version of the code ======================================= @@ -111,8 +111,9 @@ Create a dedicated environment You should set up a dedicated environment to decouple your Matplotlib development from other Python and Matplotlib installations on your system. -The simplest way to do this is to use either Python's virtual environment -`venv`_ or `conda`_. +We recommend using one of the following options for a dedicated development environment +because these options are configured to install the Python dependencies as part of their +setup. .. _venv: https://docs.python.org/3/library/venv.html .. _conda: https://docs.conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html @@ -138,6 +139,8 @@ The simplest way to do this is to use either Python's virtual environment pip install -r requirements/dev/dev-requirements.txt + Remember to activate the environment whenever you start working on Matplotlib! + .. tab-item:: conda environment Create a new `conda`_ environment and install the Python dependencies with :: @@ -153,13 +156,57 @@ The simplest way to do this is to use either Python's virtual environment conda activate mpl-dev -Remember to activate the environment whenever you start working on Matplotlib. + Remember to activate the environment whenever you start working on Matplotlib! + + .. tab-item:: :octicon:`codespaces` GitHub Codespaces + + `GitHub Codespaces `_ is a cloud-based + in-browser development environment that comes with the appropriate setup to + contribute to Matplotlib. + + #. Open codespaces on your fork by clicking on the green :octicon:`code` ``Code`` + button on the GitHub web interface and selecting the ``Codespaces`` tab. + + #. Next, click on "Open codespaces on ". You will be + able to change branches later, so you can select the default + ``main`` branch. + + #. After the codespace is created, you will be taken to a new browser + tab where you can use the terminal to activate a pre-defined conda + environment called ``mpl-dev``:: + + conda activate mpl-dev + + Remember to activate the *mpl-dev* environment whenever you start working on + Matplotlib. + + If you need to open a GUI window with Matplotlib output on Codespaces, our + configuration includes a `light-weight Fluxbox-based desktop + `_. + You can use it by connecting to this desktop via your web browser. To do this: + + #. Press ``F1`` or ``Ctrl/Cmd+Shift+P`` and select + ``Ports: Focus on Ports View`` in the VSCode session to bring it into + focus. Open the ports view in your tool, select the ``noVNC`` port, and + click the Globe icon. + #. In the browser that appears, click the Connect button and enter the desktop + password (``vscode`` by default). + + Check the `GitHub instructions + `_ + for more details on connecting to the desktop. + + If you also built the documentation pages, you can view them using Codespaces. + Use the "Extensions" icon in the activity bar to install the "Live Server" + extension. Locate the ``doc/build/html`` folder in the Explorer, right click + the file you want to open and select "Open with Live Server." + Install external dependencies ============================= Python dependencies were installed as part of :ref:`setting up the environment `. -Additionally, the following non-Python dependencies must also be installed: +Additionally, the following non-Python dependencies must also be installed locally: .. rst-class:: checklist @@ -167,7 +214,8 @@ Additionally, the following non-Python dependencies must also be installed: * :ref:`documentation build dependencies ` -For a full list of dependencies, see :ref:`dependencies`. +For a full list of dependencies, see :ref:`dependencies`. External dependencies do not +need to be installed when working in codespaces. .. _development-install: diff --git a/doc/devel/development_workflow.rst b/doc/devel/development_workflow.rst index a62971ac76d6..438b93314171 100644 --- a/doc/devel/development_workflow.rst +++ b/doc/devel/development_workflow.rst @@ -28,6 +28,30 @@ why you did it, we recommend the following: Matplotlib developers can give feedback and eventually include your suggested code into the ``main`` branch. +Overview +-------- + +After :ref:`setting up a development environment `, the typical +workflow is: + +#. Fetch all changes from ``upstream/main``:: + + git fetch upstream/main + +#. Start a new *feature branch* from ``upstream/main``:: + + git checkout -b my-feature upstream/main + +#. When you're done editing, e.g., ``lib/matplotlib/collections.py``, record your changes in Git:: + + git add lib/matplotlib/collections.py + git commit -m 'a commit message' + +#. Push the changes to your GitHub fork:: + + git push -u origin my-feature + + .. _update-mirror-main: Update the ``main`` branch @@ -49,16 +73,14 @@ Make a new feature branch When you are ready to make some changes to the code, you should start a new branch. Branches that are for a collection of related edits are often called -'feature branches'. - -Making a new branch for each set of related changes will make it easier for -someone reviewing your branch to see what you are doing. +'feature branches'. Making a new branch for each set of related changes will make it +easier for someone reviewing your branch to see what you are doing. Choose an informative name for the branch to remind yourself and the rest of us what the changes in the branch are for. For example ``add-ability-to-fly``, or ``bugfix-for-issue-42``. -:: +The process for creating a new feature branch is:: # Update the main branch git fetch upstream @@ -130,6 +152,11 @@ Open a pull request When you are ready to ask for someone to review your code and consider a merge, `submit your Pull Request (PR) `_. +Go to the web page of *your fork* of the Matplotlib repo, and click +``Compare & pull request`` to send your changes to the maintainers for review. +The base repository is ``matplotlib/matplotlib`` and the base branch is +generally ``main``. + Enter a title for the set of changes with some explanation of what you've done. Mention anything you'd like particular attention for - such as a complicated change or some code you are not happy with. @@ -138,6 +165,9 @@ If you don't think your request is ready to be merged, just say so in your pull request message and use the "Draft PR" feature of GitHub. This is a good way of getting some preliminary code review. +For more guidance on the mechanics of making a pull request, see GitHub's +`pull request tutorial `_. + .. _update-pull-request: Update a pull request diff --git a/doc/devel/pr_guide.rst b/doc/devel/pr_guide.rst index 778d7b3c57bd..34cb64f975df 100644 --- a/doc/devel/pr_guide.rst +++ b/doc/devel/pr_guide.rst @@ -20,6 +20,8 @@ limited bandwidth. If there is no feedback within a couple of days, please ping us by posting a comment to your PR or reaching out on a :ref:`communication channel ` +.. _pr-author-guidelines: + Summary for pull request authors ================================ From 6dbb3761f960b591769bf0253a20c76e4d57b9d7 Mon Sep 17 00:00:00 2001 From: Tim Hoffmann <2836374+timhoffm@users.noreply.github.com> Date: Tue, 5 Nov 2024 19:17:02 +0100 Subject: [PATCH 045/131] Backport PR #29081: Document "none" as color value --- galleries/users_explain/colors/colors.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/galleries/users_explain/colors/colors.py b/galleries/users_explain/colors/colors.py index 9b6a3832b75c..c91a5fcb0dbe 100644 --- a/galleries/users_explain/colors/colors.py +++ b/galleries/users_explain/colors/colors.py @@ -73,6 +73,10 @@ | | | | .. versionadded:: 3.8 | | +--------------------------------------+--------------------------------------+ +| The special value "none" is fully | - ``'none'`` | +| transparent, i.e. equivalent to a | | +| RGBA value ``(0.0, 0.0, 0.0, 0.0)`` | | ++--------------------------------------+--------------------------------------+ .. _xkcd color survey: https://xkcd.com/color/rgb/ From ec955102165b703bc682c66771fc7e3b302068d8 Mon Sep 17 00:00:00 2001 From: Tim Hoffmann <2836374+timhoffm@users.noreply.github.com> Date: Tue, 5 Nov 2024 23:12:01 +0100 Subject: [PATCH 046/131] Backport PR #29065: DOC: Update docstring of triplot() --- lib/matplotlib/tri/_tripcolor.py | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/lib/matplotlib/tri/_tripcolor.py b/lib/matplotlib/tri/_tripcolor.py index 1ac6c48a2d7c..f3c26b0b25ff 100644 --- a/lib/matplotlib/tri/_tripcolor.py +++ b/lib/matplotlib/tri/_tripcolor.py @@ -1,10 +1,11 @@ import numpy as np -from matplotlib import _api +from matplotlib import _api, _docstring from matplotlib.collections import PolyCollection, TriMesh from matplotlib.tri._triangulation import Triangulation +@_docstring.interpd def tripcolor(ax, *args, alpha=1.0, norm=None, cmap=None, vmin=None, vmax=None, shading='flat', facecolors=None, **kwargs): """ @@ -54,8 +55,25 @@ def tripcolor(ax, *args, alpha=1.0, norm=None, cmap=None, vmin=None, values used for each triangle are from the mean c of the triangle's three points. If *shading* is 'gouraud' then color values must be defined at points. - other_parameters - All other parameters are the same as for `~.Axes.pcolor`. + %(cmap_doc)s + + %(norm_doc)s + + %(vmin_vmax_doc)s + + %(colorizer_doc)s + + Returns + ------- + `~matplotlib.collections.PolyCollection` or `~matplotlib.collections.TriMesh` + The result depends on *shading*: For ``shading='flat'`` the result is a + `.PolyCollection`, for ``shading='gouraud'`` the result is a `.TriMesh`. + + Other Parameters + ---------------- + **kwargs : `~matplotlib.collections.Collection` properties + + %(Collection:kwdoc)s """ _api.check_in_list(['flat', 'gouraud'], shading=shading) From 43f84aaf4795234e554b9947081324ac6c7ff9bf Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Tue, 5 Nov 2024 18:06:13 -0500 Subject: [PATCH 047/131] Backport PR #29085: FIX: Update GTK3Agg backend export name for consistency --- lib/matplotlib/backends/backend_gtk3agg.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/matplotlib/backends/backend_gtk3agg.py b/lib/matplotlib/backends/backend_gtk3agg.py index 90b38ffa4ec3..bb469b85783d 100644 --- a/lib/matplotlib/backends/backend_gtk3agg.py +++ b/lib/matplotlib/backends/backend_gtk3agg.py @@ -70,5 +70,5 @@ def blit(self, bbox=None): @_BackendGTK3.export -class _BackendGTK3Cairo(_BackendGTK3): +class _BackendGTK3Agg(_BackendGTK3): FigureCanvas = FigureCanvasGTK3Agg From 4883c9ff57e43e69f5eef3b0efd16299cda3f0dd Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Tue, 5 Nov 2024 20:55:31 -0500 Subject: [PATCH 048/131] Backport PR #29088: DOC: Format aliases in kwargs tables --- lib/matplotlib/artist.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/matplotlib/artist.py b/lib/matplotlib/artist.py index e6f323d4a1ce..17724c8b027a 100644 --- a/lib/matplotlib/artist.py +++ b/lib/matplotlib/artist.py @@ -1586,7 +1586,8 @@ def aliased_name_rest(self, s, target): if target in self._NOT_LINKABLE: return f'``{s}``' - aliases = ''.join(' or %s' % x for x in sorted(self.aliasd.get(s, []))) + aliases = ''.join( + f' or :meth:`{a} <{target}>`' for a in sorted(self.aliasd.get(s, []))) return f':meth:`{s} <{target}>`{aliases}' def pprint_setters(self, prop=None, leadingspace=2): From f8ba5e368f331a9f3f99b3495828387659f15a0f Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Wed, 6 Nov 2024 16:00:46 -0500 Subject: [PATCH 049/131] Backport PR #29071: Bump pypa/gh-action-pypi-publish from 1.10.3 to 1.11.0 in the actions group --- .github/workflows/cibuildwheel.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cibuildwheel.yml b/.github/workflows/cibuildwheel.yml index cd9ad2161595..f88c4885ad48 100644 --- a/.github/workflows/cibuildwheel.yml +++ b/.github/workflows/cibuildwheel.yml @@ -234,4 +234,4 @@ jobs: subject-path: dist/matplotlib-* - name: Publish package distributions to PyPI - uses: pypa/gh-action-pypi-publish@f7600683efdcb7656dec5b29656edb7bc586e597 # v1.10.3 + uses: pypa/gh-action-pypi-publish@fb13cb306901256ace3dab689990e13a5550ffaa # v1.11.0 From a52ed0d71548a40256fc143d708abde99fe97f2e Mon Sep 17 00:00:00 2001 From: Tim Hoffmann <2836374+timhoffm@users.noreply.github.com> Date: Wed, 6 Nov 2024 09:27:44 +0100 Subject: [PATCH 050/131] Backport PR #29094: DOC: fix link in See Also section of axes.violin --- lib/matplotlib/axes/_axes.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/matplotlib/axes/_axes.py b/lib/matplotlib/axes/_axes.py index 5786620c4c29..f6a4ebfdc7c6 100644 --- a/lib/matplotlib/axes/_axes.py +++ b/lib/matplotlib/axes/_axes.py @@ -8618,7 +8618,7 @@ def violin(self, vpstats, positions=None, vert=None, See Also -------- - violin : + violinplot : Draw a violin plot from data instead of pre-computed statistics. """ From cebc9401b2a7652c0999b4ad5d876f8633adfcd3 Mon Sep 17 00:00:00 2001 From: Greg Lucas Date: Thu, 7 Nov 2024 09:04:28 -0700 Subject: [PATCH 051/131] Backport PR #29097: ENH: add back/forward buttons to osx backend move --- src/_macosx.m | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/_macosx.m b/src/_macosx.m index fc8982b582dd..30c5ddf30ce0 100755 --- a/src/_macosx.m +++ b/src/_macosx.m @@ -289,10 +289,13 @@ bool mpl_check_button(bool present, PyObject* set, char const* name) { PyGILState_STATE gstate = PyGILState_Ensure(); PyObject* set = NULL; NSUInteger buttons = [NSEvent pressedMouseButtons]; + if (!(set = PySet_New(NULL)) || mpl_check_button(buttons & (1 << 0), set, "LEFT") || mpl_check_button(buttons & (1 << 1), set, "RIGHT") - || mpl_check_button(buttons & (1 << 2), set, "MIDDLE")) { + || mpl_check_button(buttons & (1 << 2), set, "MIDDLE") + || mpl_check_button(buttons & (1 << 3), set, "BACK") + || mpl_check_button(buttons & (1 << 4), set, "FORWARD")) { Py_CLEAR(set); // On failure, return NULL with an exception set. } PyGILState_Release(gstate); From bbfd120d9030150c7ad58648811e695693f05b52 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Thu, 7 Nov 2024 18:19:28 -0500 Subject: [PATCH 052/131] Backport PR #29099: MNT: remove _ttconv.pyi --- lib/matplotlib/_ttconv.pyi | 0 lib/matplotlib/meson.build | 1 - 2 files changed, 1 deletion(-) delete mode 100644 lib/matplotlib/_ttconv.pyi diff --git a/lib/matplotlib/_ttconv.pyi b/lib/matplotlib/_ttconv.pyi deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/lib/matplotlib/meson.build b/lib/matplotlib/meson.build index 44291fcc3da7..c4746f332bcb 100644 --- a/lib/matplotlib/meson.build +++ b/lib/matplotlib/meson.build @@ -91,7 +91,6 @@ typing_sources = [ '_enums.pyi', '_path.pyi', '_pylab_helpers.pyi', - '_ttconv.pyi', 'animation.pyi', 'artist.pyi', 'axis.pyi', From c87f8078114310ac93c548686764ef5e5aaa8861 Mon Sep 17 00:00:00 2001 From: Ruth Comer <10599679+rcomer@users.noreply.github.com> Date: Mon, 11 Nov 2024 19:02:56 +0000 Subject: [PATCH 053/131] Backport PR #29120: DOC: Switch nested pie example from cmaps to color_sequences --- galleries/examples/pie_and_polar_charts/nested_pie.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/galleries/examples/pie_and_polar_charts/nested_pie.py b/galleries/examples/pie_and_polar_charts/nested_pie.py index c83b4f6f84ee..61cb5e6ee429 100644 --- a/galleries/examples/pie_and_polar_charts/nested_pie.py +++ b/galleries/examples/pie_and_polar_charts/nested_pie.py @@ -31,9 +31,9 @@ size = 0.3 vals = np.array([[60., 32.], [37., 40.], [29., 10.]]) -cmap = plt.colormaps["tab20c"] -outer_colors = cmap(np.arange(3)*4) -inner_colors = cmap([1, 2, 5, 6, 9, 10]) +tab20c = plt.color_sequences["tab20c"] +outer_colors = [tab20c[i] for i in [0, 4, 8]] +inner_colors = [tab20c[i] for i in [1, 2, 5, 6, 9, 10]] ax.pie(vals.sum(axis=1), radius=1, colors=outer_colors, wedgeprops=dict(width=size, edgecolor='w')) From 1481dca84fff29a85e7c5256ee07124f9354d125 Mon Sep 17 00:00:00 2001 From: Ruth Comer <10599679+rcomer@users.noreply.github.com> Date: Mon, 11 Nov 2024 19:02:56 +0000 Subject: [PATCH 054/131] Backport PR #29120: DOC: Switch nested pie example from cmaps to color_sequences --- galleries/examples/pie_and_polar_charts/nested_pie.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/galleries/examples/pie_and_polar_charts/nested_pie.py b/galleries/examples/pie_and_polar_charts/nested_pie.py index 412299bb4446..699360a1e3fa 100644 --- a/galleries/examples/pie_and_polar_charts/nested_pie.py +++ b/galleries/examples/pie_and_polar_charts/nested_pie.py @@ -31,9 +31,9 @@ size = 0.3 vals = np.array([[60., 32.], [37., 40.], [29., 10.]]) -cmap = plt.colormaps["tab20c"] -outer_colors = cmap(np.arange(3)*4) -inner_colors = cmap([1, 2, 5, 6, 9, 10]) +tab20c = plt.color_sequences["tab20c"] +outer_colors = [tab20c[i] for i in [0, 4, 8]] +inner_colors = [tab20c[i] for i in [1, 2, 5, 6, 9, 10]] ax.pie(vals.sum(axis=1), radius=1, colors=outer_colors, wedgeprops=dict(width=size, edgecolor='w')) From f86f2391d1ef16775ad6c995165095a89f20a4de Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Tue, 12 Nov 2024 23:20:46 -0500 Subject: [PATCH 055/131] Backport PR #29128: Tweak AutoMinorLocator docstring. --- lib/matplotlib/ticker.py | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/lib/matplotlib/ticker.py b/lib/matplotlib/ticker.py index 6ba8dce4b667..801359555a69 100644 --- a/lib/matplotlib/ticker.py +++ b/lib/matplotlib/ticker.py @@ -2930,20 +2930,21 @@ class AutoMinorLocator(Locator): Place evenly spaced minor ticks, with the step size and maximum number of ticks chosen automatically. - The Axis scale must be linear with evenly spaced major ticks . + The Axis must use a linear scale and have evenly spaced major ticks. """ def __init__(self, n=None): """ - *n* is the number of subdivisions of the interval between - major ticks; e.g., n=2 will place a single minor tick midway - between major ticks. - - If *n* is omitted or None, the value stored in rcParams will be used. - In case *n* is set to 'auto', it will be set to 4 or 5. If the distance - between the major ticks equals 1, 2.5, 5 or 10 it can be perfectly - divided in 5 equidistant sub-intervals with a length multiple of - 0.05. Otherwise it is divided in 4 sub-intervals. + Parameters + ---------- + n : int or 'auto', default: :rc:`xtick.minor.ndivs` or :rc:`ytick.minor.ndivs` + The number of subdivisions of the interval between major ticks; + e.g., n=2 will place a single minor tick midway between major ticks. + + If *n* is 'auto', it will be set to 4 or 5: if the distance + between the major ticks equals 1, 2.5, 5 or 10 it can be perfectly + divided in 5 equidistant sub-intervals with a length multiple of + 0.05; otherwise, it is divided in 4 sub-intervals. """ self.ndivs = n From 417bdf06558a65a18b901ef29d65b55a90ec57d3 Mon Sep 17 00:00:00 2001 From: Thomas A Caswell Date: Wed, 13 Nov 2024 09:27:39 -0500 Subject: [PATCH 056/131] Backport PR #29134: MNT: Temporarily skip failing test to unbreak CI --- lib/matplotlib/tests/test_backends_interactive.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/matplotlib/tests/test_backends_interactive.py b/lib/matplotlib/tests/test_backends_interactive.py index 05f59ce39fa4..eb3557ae33f9 100644 --- a/lib/matplotlib/tests/test_backends_interactive.py +++ b/lib/matplotlib/tests/test_backends_interactive.py @@ -241,6 +241,9 @@ def test_interactive_backend(env, toolbar): pytest.skip("toolmanager is not implemented for macosx.") if env["MPLBACKEND"] == "wx": pytest.skip("wx backend is deprecated; tests failed on appveyor") + if env["MPLBACKEND"] == "wxagg" and toolbar == "toolmanager": + pytest.skip("Temporarily deactivated: show() changes figure height " + "and thus fails the test") try: proc = _run_helper( _test_interactive_impl, From 1dd33612322295a40fc535e14269405801d6daca Mon Sep 17 00:00:00 2001 From: Tim Hoffmann <2836374+timhoffm@users.noreply.github.com> Date: Thu, 14 Nov 2024 13:58:52 +0100 Subject: [PATCH 057/131] Backport PR #29080: Updates the `galleries/tutorials/artists.py` file in response to issue #28920 --- galleries/tutorials/artists.py | 34 +++++++++++++++------------------- 1 file changed, 15 insertions(+), 19 deletions(-) diff --git a/galleries/tutorials/artists.py b/galleries/tutorials/artists.py index f5e4589e8a52..a258eb71d447 100644 --- a/galleries/tutorials/artists.py +++ b/galleries/tutorials/artists.py @@ -11,15 +11,15 @@ There are three layers to the Matplotlib API. -* the :class:`matplotlib.backend_bases.FigureCanvas` is the area onto which +* the :class:`!matplotlib.backend_bases.FigureCanvas` is the area onto which the figure is drawn -* the :class:`matplotlib.backend_bases.Renderer` is the object which knows how - to draw on the :class:`~matplotlib.backend_bases.FigureCanvas` +* the :class:`!matplotlib.backend_bases.Renderer` is the object which knows how + to draw on the :class:`!matplotlib.backend_bases.FigureCanvas` * and the :class:`matplotlib.artist.Artist` is the object that knows how to use a renderer to paint onto the canvas. -The :class:`~matplotlib.backend_bases.FigureCanvas` and -:class:`~matplotlib.backend_bases.Renderer` handle all the details of +The :class:`!matplotlib.backend_bases.FigureCanvas` and +:class:`!matplotlib.backend_bases.Renderer` handle all the details of talking to user interface toolkits like `wxPython `_ or drawing languages like PostScript®, and the ``Artist`` handles all the high level constructs like representing @@ -156,12 +156,10 @@ class in the Matplotlib API, and the one you will be working with most # (the standard white box with black edges in the typical Matplotlib # plot, has a ``Rectangle`` instance that determines the color, # transparency, and other properties of the Axes. These instances are -# stored as member variables :attr:`Figure.patch -# ` and :attr:`Axes.patch -# ` ("Patch" is a name inherited from -# MATLAB, and is a 2D "patch" of color on the figure, e.g., rectangles, -# circles and polygons). Every Matplotlib ``Artist`` has the following -# properties +# stored as member variables :attr:`!Figure.patch` and :attr:`!Axes.patch` +# ("Patch" is a name inherited from MATLAB, and is a 2D "patch" +# of color on the figure, e.g., rectangles, circles and polygons). +# Every Matplotlib ``Artist`` has the following properties # # ========== ================================================================= # Property Description @@ -284,7 +282,7 @@ class in the Matplotlib API, and the one you will be working with most # :class:`matplotlib.figure.Figure`, and it contains everything in the # figure. The background of the figure is a # :class:`~matplotlib.patches.Rectangle` which is stored in -# :attr:`Figure.patch `. As +# :attr:`!Figure.patch`. As # you add subplots (:meth:`~matplotlib.figure.Figure.add_subplot`) and # Axes (:meth:`~matplotlib.figure.Figure.add_axes`) to the figure # these will be appended to the :attr:`Figure.axes @@ -331,8 +329,7 @@ class in the Matplotlib API, and the one you will be working with most # # As with all ``Artist``\s, you can control this coordinate system by setting # the transform property. You can explicitly use "figure coordinates" by -# setting the ``Artist`` transform to :attr:`fig.transFigure -# `: +# setting the ``Artist`` transform to :attr:`!fig.transFigure`: import matplotlib.lines as lines @@ -375,7 +372,7 @@ class in the Matplotlib API, and the one you will be working with most # customize the ``Artists`` it contains. Like the # :class:`~matplotlib.figure.Figure`, it contains a # :class:`~matplotlib.patches.Patch` -# :attr:`~matplotlib.axes.Axes.patch` which is a +# :attr:`!matplotlib.axes.Axes.patch` which is a # :class:`~matplotlib.patches.Rectangle` for Cartesian coordinates and a # :class:`~matplotlib.patches.Circle` for polar coordinates; this patch # determines the shape, background and border of the plotting region:: @@ -408,8 +405,7 @@ class in the Matplotlib API, and the one you will be working with most # # Similarly, methods that create patches, like # :meth:`~matplotlib.axes.Axes.bar` creates a list of rectangles, will -# add the patches to the :attr:`Axes.patches -# ` list: +# add the patches to the :attr:`!Axes.patches` list: # # .. sourcecode:: ipython # @@ -556,8 +552,8 @@ class in the Matplotlib API, and the one you will be working with most # important ``Artist`` containers: the :class:`~matplotlib.axis.XAxis` # and :class:`~matplotlib.axis.YAxis`, which handle the drawing of the # ticks and labels. These are stored as instance variables -# :attr:`~matplotlib.axes.Axes.xaxis` and -# :attr:`~matplotlib.axes.Axes.yaxis`. The ``XAxis`` and ``YAxis`` +# :attr:`!matplotlib.axes.Axes.xaxis` and +# :attr:`!matplotlib.axes.Axes.yaxis`. The ``XAxis`` and ``YAxis`` # containers will be detailed below, but note that the ``Axes`` contains # many helper methods which forward calls on to the # :class:`~matplotlib.axis.Axis` instances, so you often do not need to From 7fe551f82dca56018cd2133d43c3cb3cb1ff270b Mon Sep 17 00:00:00 2001 From: Jody Klymak Date: Fri, 15 Nov 2024 12:10:20 -0800 Subject: [PATCH 058/131] Backport PR #29144: Use both TCL_SETVAR and TCL_SETVAR2 for tcl 9 support --- src/_tkagg.cpp | 20 ++++++++++++++++---- src/_tkmini.h | 3 +++ 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/src/_tkagg.cpp b/src/_tkagg.cpp index 04ca3d4d1b84..bfb19cc476ea 100644 --- a/src/_tkagg.cpp +++ b/src/_tkagg.cpp @@ -92,6 +92,7 @@ static Tk_PhotoPutBlock_t TK_PHOTO_PUT_BLOCK; // Global vars for Tcl functions. We load these symbols from the tkinter // extension module or loaded Tcl libraries at run-time. static Tcl_SetVar_t TCL_SETVAR; +static Tcl_SetVar2_t TCL_SETVAR2; static void mpl_tk_blit(py::object interp_obj, const char *photo_name, @@ -173,7 +174,15 @@ DpiSubclassProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam, std::string dpi = std::to_string(LOWORD(wParam)); Tcl_Interp* interp = (Tcl_Interp*)dwRefData; - TCL_SETVAR(interp, var_name.c_str(), dpi.c_str(), 0); + if (TCL_SETVAR) { + TCL_SETVAR(interp, var_name.c_str(), dpi.c_str(), 0); + } else if (TCL_SETVAR2) { + TCL_SETVAR2(interp, var_name.c_str(), NULL, dpi.c_str(), 0); + } else { + // This should be prevented at import time, and therefore unreachable. + // But defensively throw just in case. + throw std::runtime_error("Unable to call Tcl_SetVar or Tcl_SetVar2"); + } } return 0; case WM_NCDESTROY: @@ -246,13 +255,16 @@ bool load_tcl_tk(T lib) if (auto ptr = dlsym(lib, "Tcl_SetVar")) { TCL_SETVAR = (Tcl_SetVar_t)ptr; } + if (auto ptr = dlsym(lib, "Tcl_SetVar2")) { + TCL_SETVAR2 = (Tcl_SetVar2_t)ptr; + } if (auto ptr = dlsym(lib, "Tk_FindPhoto")) { TK_FIND_PHOTO = (Tk_FindPhoto_t)ptr; } if (auto ptr = dlsym(lib, "Tk_PhotoPutBlock")) { TK_PHOTO_PUT_BLOCK = (Tk_PhotoPutBlock_t)ptr; } - return TCL_SETVAR && TK_FIND_PHOTO && TK_PHOTO_PUT_BLOCK; + return (TCL_SETVAR || TCL_SETVAR2) && TK_FIND_PHOTO && TK_PHOTO_PUT_BLOCK; } #ifdef WIN32_DLL @@ -343,8 +355,8 @@ PYBIND11_MODULE(_tkagg, m, py::mod_gil_not_used()) throw py::error_already_set(); } - if (!TCL_SETVAR) { - throw py::import_error("Failed to load Tcl_SetVar"); + if (!(TCL_SETVAR || TCL_SETVAR2)) { + throw py::import_error("Failed to load Tcl_SetVar or Tcl_SetVar2"); } else if (!TK_FIND_PHOTO) { throw py::import_error("Failed to load Tk_FindPhoto"); } else if (!TK_PHOTO_PUT_BLOCK) { diff --git a/src/_tkmini.h b/src/_tkmini.h index 85f245815e4c..1c74cf9720f8 100644 --- a/src/_tkmini.h +++ b/src/_tkmini.h @@ -104,6 +104,9 @@ typedef int (*Tk_PhotoPutBlock_t) (Tcl_Interp *interp, Tk_PhotoHandle handle, /* Tcl_SetVar typedef */ typedef const char *(*Tcl_SetVar_t)(Tcl_Interp *interp, const char *varName, const char *newValue, int flags); +/* Tcl_SetVar2 typedef */ +typedef const char *(*Tcl_SetVar2_t)(Tcl_Interp *interp, const char *part1, const char *part2, + const char *newValue, int flags); #ifdef __cplusplus } From 8d8d1d6a7ad9ff03d86ec2d30c65002eb5a93ba4 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Wed, 20 Nov 2024 14:46:04 -0500 Subject: [PATCH 059/131] Backport CI config updates to v3.9.x (#29149) This includes updates to `actions/attest-build-provenance`, `pypa/cibuildwheel`, `pypa/gh-action-pypi-publish`, `deadsnakes/action`, and cleanup of `workflow_dispatch` and outdated skips. --- .github/workflows/cibuildwheel.yml | 18 ++++++++---------- .github/workflows/cygwin.yml | 1 - .github/workflows/tests.yml | 3 +-- 3 files changed, 9 insertions(+), 13 deletions(-) diff --git a/.github/workflows/cibuildwheel.yml b/.github/workflows/cibuildwheel.yml index a145b5bbcc08..aa0366ad16ff 100644 --- a/.github/workflows/cibuildwheel.yml +++ b/.github/workflows/cibuildwheel.yml @@ -143,13 +143,11 @@ jobs: path: dist/ - name: Build wheels for CPython 3.13 - uses: pypa/cibuildwheel@bd033a44476646b606efccdd5eed92d5ea1d77ad # v2.20.0 + uses: pypa/cibuildwheel@7940a4c0e76eb2030e473a5f864f291f63ee879b # v2.21.3 with: package-dir: dist/${{ needs.build_sdist.outputs.SDIST_NAME }} env: CIBW_BUILD: "cp313-* cp313t-*" - # No free-threading wheels for NumPy; musllinux skipped for main builds also. - CIBW_SKIP: "cp313t-win_amd64 *-musllinux_aarch64" CIBW_BUILD_FRONTEND: "pip; args: --pre --extra-index-url https://pypi.anaconda.org/scientific-python-nightly-wheels/simple" CIBW_FREE_THREADED_SUPPORT: true @@ -163,7 +161,7 @@ jobs: CIBW_ARCHS: ${{ matrix.cibw_archs }} - name: Build wheels for CPython 3.12 - uses: pypa/cibuildwheel@bd033a44476646b606efccdd5eed92d5ea1d77ad # v2.20.0 + uses: pypa/cibuildwheel@7940a4c0e76eb2030e473a5f864f291f63ee879b # v2.21.3 with: package-dir: dist/${{ needs.build_sdist.outputs.SDIST_NAME }} env: @@ -171,7 +169,7 @@ jobs: CIBW_ARCHS: ${{ matrix.cibw_archs }} - name: Build wheels for CPython 3.11 - uses: pypa/cibuildwheel@bd033a44476646b606efccdd5eed92d5ea1d77ad # v2.20.0 + uses: pypa/cibuildwheel@7940a4c0e76eb2030e473a5f864f291f63ee879b # v2.21.3 with: package-dir: dist/${{ needs.build_sdist.outputs.SDIST_NAME }} env: @@ -179,7 +177,7 @@ jobs: CIBW_ARCHS: ${{ matrix.cibw_archs }} - name: Build wheels for CPython 3.10 - uses: pypa/cibuildwheel@bd033a44476646b606efccdd5eed92d5ea1d77ad # v2.20.0 + uses: pypa/cibuildwheel@7940a4c0e76eb2030e473a5f864f291f63ee879b # v2.21.3 with: package-dir: dist/${{ needs.build_sdist.outputs.SDIST_NAME }} env: @@ -187,7 +185,7 @@ jobs: CIBW_ARCHS: ${{ matrix.cibw_archs }} - name: Build wheels for CPython 3.9 - uses: pypa/cibuildwheel@7e5a838a63ac8128d71ab2dfd99e4634dd1bca09 # v2.19.2 + uses: pypa/cibuildwheel@7940a4c0e76eb2030e473a5f864f291f63ee879b # v2.21.3 with: package-dir: dist/${{ needs.build_sdist.outputs.SDIST_NAME }} env: @@ -195,7 +193,7 @@ jobs: CIBW_ARCHS: ${{ matrix.cibw_archs }} - name: Build wheels for PyPy - uses: pypa/cibuildwheel@bd033a44476646b606efccdd5eed92d5ea1d77ad # v2.20.0 + uses: pypa/cibuildwheel@7940a4c0e76eb2030e473a5f864f291f63ee879b # v2.21.3 with: package-dir: dist/${{ needs.build_sdist.outputs.SDIST_NAME }} env: @@ -231,9 +229,9 @@ jobs: run: ls dist - name: Generate artifact attestation for sdist and wheel - uses: actions/attest-build-provenance@210c1913531870065f03ce1f9440dd87bc0938cd # v1.4.0 + uses: actions/attest-build-provenance@ef244123eb79f2f7a7e75d99086184180e6d0018 # v1.4.4 with: subject-path: dist/matplotlib-* - name: Publish package distributions to PyPI - uses: pypa/gh-action-pypi-publish@ec4db0b4ddc65acdf4bff5fa45ac92d78b56bdf0 # v1.9.0 + uses: pypa/gh-action-pypi-publish@15c56dba361d8335944d31a2ecd17d700fc7bcbc # v1.12.2 diff --git a/.github/workflows/cygwin.yml b/.github/workflows/cygwin.yml index 58c132315b6f..a3f93ba195a8 100644 --- a/.github/workflows/cygwin.yml +++ b/.github/workflows/cygwin.yml @@ -29,7 +29,6 @@ on: # 5:47 UTC on Saturdays - cron: "47 5 * * 6" workflow_dispatch: - workflow: "*" permissions: contents: read diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 4100fda43a36..853311366ee3 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -21,7 +21,6 @@ on: # 5:47 UTC on Saturdays - cron: "47 5 * * 6" workflow_dispatch: - workflow: "*" env: NO_AT_BRIDGE: 1 # Necessary for GTK3 interactive test. @@ -127,7 +126,7 @@ jobs: allow-prereleases: true - name: Set up Python ${{ matrix.python-version }} - uses: deadsnakes/action@6c8b9b82fe0b4344f4b98f2775fcc395df45e494 # v3.1.0 + uses: deadsnakes/action@e640ac8743173a67cca4d7d77cd837e514bf98e8 # v3.2.0 if: matrix.python-version == '3.13t' with: python-version: '3.13' From e25bfee992c695203061b3965bbafa663b512dde Mon Sep 17 00:00:00 2001 From: Kyle Sunden Date: Wed, 20 Nov 2024 15:09:16 -0600 Subject: [PATCH 060/131] Fix violin test --- lib/matplotlib/tests/test_axes.py | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/lib/matplotlib/tests/test_axes.py b/lib/matplotlib/tests/test_axes.py index e3a59a1751ab..6fe57a3e0d03 100644 --- a/lib/matplotlib/tests/test_axes.py +++ b/lib/matplotlib/tests/test_axes.py @@ -9312,16 +9312,13 @@ def test_violinplot_orientation(fig_test, fig_ref): plt.close() - # Deprecation of `vert: bool` keyword - with pytest.warns(mpl.MatplotlibDeprecationWarning, - match='vert: bool was deprecated in Matplotlib 3.10'): - # Compare images between a figure that - # uses vert and one that uses orientation. - ax_ref = fig_ref.subplots() - ax_ref.violinplot(all_data, vert=False) + # Compare images between a figure that + # uses vert and one that uses orientation. + ax_ref = fig_ref.subplots() + ax_ref.violinplot(all_data, vert=False) - ax_test = fig_test.subplots() - ax_test.violinplot(all_data, orientation='horizontal') + ax_test = fig_test.subplots() + ax_test.violinplot(all_data, orientation='horizontal') @check_figures_equal(extensions=['png']) From 2a4a0a290e3dcb2ac31d66ee9d459ebac960a0dd Mon Sep 17 00:00:00 2001 From: Tim Hoffmann <2836374+timhoffm@users.noreply.github.com> Date: Thu, 21 Nov 2024 09:56:39 +0100 Subject: [PATCH 061/131] Backport PR #29073: Update secondary_axis tutorial --- .../secondary_axis.py | 52 +++++++++---------- 1 file changed, 25 insertions(+), 27 deletions(-) diff --git a/galleries/examples/subplots_axes_and_figures/secondary_axis.py b/galleries/examples/subplots_axes_and_figures/secondary_axis.py index d6dfd33f62c1..842b296f78cf 100644 --- a/galleries/examples/subplots_axes_and_figures/secondary_axis.py +++ b/galleries/examples/subplots_axes_and_figures/secondary_axis.py @@ -17,7 +17,6 @@ import numpy as np import matplotlib.dates as mdates -from matplotlib.ticker import AutoMinorLocator fig, ax = plt.subplots(layout='constrained') x = np.arange(0, 360, 1) @@ -96,48 +95,47 @@ def one_over(x): plt.show() # %% -# Sometime we want to relate the axes in a transform that is ad-hoc from -# the data, and is derived empirically. In that case we can set the -# forward and inverse transforms functions to be linear interpolations from the -# one data set to the other. +# Sometime we want to relate the axes in a transform that is ad-hoc from the data, and +# is derived empirically. Or, one axis could be a complicated nonlinear function of the +# other. In these cases we can set the forward and inverse transform functions to be +# linear interpolations from the one set of independent variables to the other. # # .. note:: # # In order to properly handle the data margins, the mapping functions # (``forward`` and ``inverse`` in this example) need to be defined beyond the -# nominal plot limits. -# -# In the specific case of the numpy linear interpolation, `numpy.interp`, -# this condition can be arbitrarily enforced by providing optional keyword -# arguments *left*, *right* such that values outside the data range are -# mapped well outside the plot limits. +# nominal plot limits. This condition can be enforced by extending the +# interpolation beyond the plotted values, both to the left and the right, +# see ``x1n`` and ``x2n`` below. fig, ax = plt.subplots(layout='constrained') -xdata = np.arange(1, 11, 0.4) -ydata = np.random.randn(len(xdata)) -ax.plot(xdata, ydata, label='Plotted data') - -xold = np.arange(0, 11, 0.2) -# fake data set relating x coordinate to another data-derived coordinate. -# xnew must be monotonic, so we sort... -xnew = np.sort(10 * np.exp(-xold / 4) + np.random.randn(len(xold)) / 3) - -ax.plot(xold[3:], xnew[3:], label='Transform data') -ax.set_xlabel('X [m]') +x1_vals = np.arange(2, 11, 0.4) +# second independent variable is a nonlinear function of the other. +x2_vals = x1_vals ** 2 +ydata = 50.0 + 20 * np.random.randn(len(x1_vals)) +ax.plot(x1_vals, ydata, label='Plotted data') +ax.plot(x1_vals, x2_vals, label=r'$x_2 = x_1^2$') +ax.set_xlabel(r'$x_1$') ax.legend() +# the forward and inverse functions must be defined on the complete visible axis range +x1n = np.linspace(0, 20, 201) +x2n = x1n**2 + def forward(x): - return np.interp(x, xold, xnew) + return np.interp(x, x1n, x2n) def inverse(x): - return np.interp(x, xnew, xold) - + return np.interp(x, x2n, x1n) +# use axvline to prove that the derived secondary axis is correctly plotted +ax.axvline(np.sqrt(40), color="grey", ls="--") +ax.axvline(10, color="grey", ls="--") secax = ax.secondary_xaxis('top', functions=(forward, inverse)) -secax.xaxis.set_minor_locator(AutoMinorLocator()) -secax.set_xlabel('$X_{other}$') +secax.set_xticks([10, 20, 40, 60, 80, 100]) +secax.set_xlabel(r'$x_2$') plt.show() From 13e32026a76360a66d3117fb592e2137586b7e3c Mon Sep 17 00:00:00 2001 From: "Lumberbot (aka Jack)" <39504233+meeseeksmachine@users.noreply.github.com> Date: Thu, 21 Nov 2024 11:51:21 -0800 Subject: [PATCH 062/131] Backport PR #29163: ci: Remove outdated pkg-config package on macOS (#29164) Co-authored-by: Elliott Sales de Andrade --- .github/workflows/tests.yml | 2 ++ azure-pipelines.yml | 2 ++ 2 files changed, 4 insertions(+) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index f73fde457be3..72342af171c8 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -199,6 +199,8 @@ jobs: brew unlink ${python_package} brew link --overwrite ${python_package} done + # Workaround for https://github.com/actions/runner-images/issues/10984 + brew uninstall --ignore-dependencies --force pkg-config@0.29.2 brew install ccache ghostscript gobject-introspection gtk4 ninja brew install --cask font-noto-sans-cjk inkscape ;; diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 4bccb5da8ed2..0c891fe42fef 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -122,6 +122,8 @@ stages: brew unlink ${python_package} brew link --overwrite ${python_package} done + # Workaround for https://github.com/actions/runner-images/issues/10984 + brew uninstall --ignore-dependencies --force pkg-config@0.29.2 brew install --cask xquartz brew install ccache ffmpeg imagemagick mplayer ninja pkg-config brew install --cask font-noto-sans-cjk-sc From d71ff494bbf808f029cd6a3f3c0de061ea480010 Mon Sep 17 00:00:00 2001 From: "Lumberbot (aka Jack)" <39504233+meeseeksmachine@users.noreply.github.com> Date: Thu, 21 Nov 2024 11:54:15 -0800 Subject: [PATCH 063/131] Backport PR #29153: Bump codecov/codecov-action from 4 to 5 in the actions group (#29165) Co-authored-by: Greg Lucas --- .github/workflows/tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 853311366ee3..6d2fe41546f1 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -388,7 +388,7 @@ jobs: fi - name: Upload code coverage if: ${{ !cancelled() && github.event_name != 'schedule' }} - uses: codecov/codecov-action@v4 + uses: codecov/codecov-action@v5 with: name: "${{ matrix.python-version }} ${{ matrix.os }} ${{ matrix.name-suffix }}" token: ${{ secrets.CODECOV_TOKEN }} From 5d62c9eaccb5f1f34619e5cadb6fb841fe434524 Mon Sep 17 00:00:00 2001 From: "Lumberbot (aka Jack)" <39504233+meeseeksmachine@users.noreply.github.com> Date: Thu, 21 Nov 2024 11:54:57 -0800 Subject: [PATCH 064/131] Backport PR #29153: Bump codecov/codecov-action from 4 to 5 in the actions group (#29166) Co-authored-by: Greg Lucas --- .github/workflows/tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 72342af171c8..52a6898cf7ca 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -421,7 +421,7 @@ jobs: fi - name: Upload code coverage if: ${{ !cancelled() && github.event_name != 'schedule' }} - uses: codecov/codecov-action@v4 + uses: codecov/codecov-action@v5 with: name: "${{ matrix.python-version }} ${{ matrix.os }} ${{ matrix.name-suffix }}" token: ${{ secrets.CODECOV_TOKEN }} From cc0188e396fa3fc385844796e0c5b811b29b2412 Mon Sep 17 00:00:00 2001 From: Thomas A Caswell Date: Thu, 21 Nov 2024 15:11:52 -0500 Subject: [PATCH 065/131] Backport PR #29154: Relax conditions for warning on updating converters --- lib/matplotlib/axis.py | 8 ++++++-- lib/matplotlib/tests/test_units.py | 12 ++++++++++-- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/lib/matplotlib/axis.py b/lib/matplotlib/axis.py index 0c095e9c4e0a..dc816eccc30a 100644 --- a/lib/matplotlib/axis.py +++ b/lib/matplotlib/axis.py @@ -1842,11 +1842,15 @@ def set_converter(self, converter): self._converter_is_explicit = True def _set_converter(self, converter): - if self._converter == converter: + if self._converter is converter or self._converter == converter: return if self._converter_is_explicit: raise RuntimeError("Axis already has an explicit converter set") - elif self._converter is not None: + elif ( + self._converter is not None and + not isinstance(converter, type(self._converter)) and + not isinstance(self._converter, type(converter)) + ): _api.warn_external( "This axis already has a converter set and " "is updating to a potentially incompatible converter" diff --git a/lib/matplotlib/tests/test_units.py b/lib/matplotlib/tests/test_units.py index a8735e180bf0..42339f8c0c6f 100644 --- a/lib/matplotlib/tests/test_units.py +++ b/lib/matplotlib/tests/test_units.py @@ -6,6 +6,7 @@ from matplotlib.testing.decorators import check_figures_equal, image_comparison import matplotlib.units as munits from matplotlib.category import StrCategoryConverter, UnitData +from matplotlib.dates import DateConverter import numpy as np import pytest @@ -240,6 +241,7 @@ def test_explicit_converter(): d1 = {"a": 1, "b": 2} str_cat_converter = StrCategoryConverter() str_cat_converter_2 = StrCategoryConverter() + date_converter = DateConverter() # Explicit is set fig1, ax1 = plt.subplots() @@ -254,12 +256,18 @@ def test_explicit_converter(): with pytest.raises(RuntimeError): ax1.xaxis.set_converter(str_cat_converter_2) - # Warn when implicit overridden fig2, ax2 = plt.subplots() ax2.plot(d1.keys(), d1.values()) + # No error when equivalent type is used + ax2.xaxis.set_converter(str_cat_converter) + + fig3, ax3 = plt.subplots() + ax3.plot(d1.keys(), d1.values()) + + # Warn when implicit overridden with pytest.warns(): - ax2.xaxis.set_converter(str_cat_converter) + ax3.xaxis.set_converter(date_converter) def test_empty_default_limits(quantity_converter): From f356da148feeeee30ba4dc388d569ac860e9f8d9 Mon Sep 17 00:00:00 2001 From: Kyle Sunden Date: Tue, 19 Nov 2024 17:15:23 -0600 Subject: [PATCH 066/131] Delay warning for deprecated parameter 'vert' of box and violin on 3.10 The new parameter, 'orientation', was only added in the current release, so downstream wanting to avoid warnings would require version gates. Therefore delaying by at least one release to ease the transition. This was motivated by Pandas failing tests on this warning. This portion is made direct to v3.10.x with #29155 being the accompanying version to edit the deprecation on main. Reinstate warning as a pending warning STY: fits on one line --- lib/matplotlib/axes/_axes.py | 20 +++++++++++++------- lib/matplotlib/tests/test_axes.py | 4 +++- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/lib/matplotlib/axes/_axes.py b/lib/matplotlib/axes/_axes.py index f6a4ebfdc7c6..af5173d2503e 100644 --- a/lib/matplotlib/axes/_axes.py +++ b/lib/matplotlib/axes/_axes.py @@ -3875,9 +3875,11 @@ def boxplot(self, x, notch=None, sym=None, vert=None, control is provided by the *flierprops* parameter. vert : bool, optional - .. deprecated:: 3.10 + .. deprecated:: 3.11 Use *orientation* instead. + This is a pending deprecation for 3.10, with full deprecation + in 3.11 and removal in 3.13. If this is given during the deprecation period, it overrides the *orientation* parameter. @@ -4222,9 +4224,11 @@ def bxp(self, bxpstats, positions=None, widths=None, vert=None, The default is ``0.5*(width of the box)``, see *widths*. vert : bool, optional - .. deprecated:: 3.10 + .. deprecated:: 3.11 Use *orientation* instead. + This is a pending deprecation for 3.10, with full deprecation + in 3.11 and removal in 3.13. If this is given during the deprecation period, it overrides the *orientation* parameter. @@ -4361,9 +4365,10 @@ def merge_kw_rc(subkey, explicit, zdelta=0, usemarker=True): vert = mpl.rcParams['boxplot.vertical'] else: _api.warn_deprecated( - "3.10", + "3.11", name="vert: bool", - alternative="orientation: {'vertical', 'horizontal'}" + alternative="orientation: {'vertical', 'horizontal'}", + pending=True, ) if vert is False: orientation = 'horizontal' @@ -8642,10 +8647,11 @@ def violin(self, vpstats, positions=None, vert=None, # vert takes precedence. if vert is not None: _api.warn_deprecated( - "3.10", + "3.11", name="vert: bool", - alternative="orientation: {'vertical', 'horizontal'}" - ) + alternative="orientation: {'vertical', 'horizontal'}", + pending=True, + ) orientation = 'vertical' if vert else 'horizontal' _api.check_in_list(['horizontal', 'vertical'], orientation=orientation) diff --git a/lib/matplotlib/tests/test_axes.py b/lib/matplotlib/tests/test_axes.py index 6fe57a3e0d03..ee6f715c3ccd 100644 --- a/lib/matplotlib/tests/test_axes.py +++ b/lib/matplotlib/tests/test_axes.py @@ -9315,7 +9315,9 @@ def test_violinplot_orientation(fig_test, fig_ref): # Compare images between a figure that # uses vert and one that uses orientation. ax_ref = fig_ref.subplots() - ax_ref.violinplot(all_data, vert=False) + + with pytest.warns(PendingDeprecationWarning, match='vert: bool'): + ax_ref.violinplot(all_data, vert=False) ax_test = fig_test.subplots() ax_test.violinplot(all_data, orientation='horizontal') From 5a51e6a5dd2d0a2c38c3cc72fcb5136a4f34c549 Mon Sep 17 00:00:00 2001 From: Victor Liu Date: Fri, 22 Nov 2024 21:22:36 -0500 Subject: [PATCH 067/131] converted ps to array before slicing --- lib/mpl_toolkits/mplot3d/art3d.py | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/mpl_toolkits/mplot3d/art3d.py b/lib/mpl_toolkits/mplot3d/art3d.py index 44585ccd05e7..9c98f13c6e43 100644 --- a/lib/mpl_toolkits/mplot3d/art3d.py +++ b/lib/mpl_toolkits/mplot3d/art3d.py @@ -1218,6 +1218,7 @@ def _generate_normals(polygons): v2 = np.empty((len(polygons), 3)) for poly_i, ps in enumerate(polygons): n = len(ps) + ps = np.asarray(ps) i1, i2, i3 = 0, n//3, 2*n//3 v1[poly_i, :] = ps[i1, :] - ps[i2, :] v2[poly_i, :] = ps[i2, :] - ps[i3, :] From c4bfd54a058f9124bfb75beccafdfd03432b3778 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Fri, 22 Nov 2024 21:50:55 -0500 Subject: [PATCH 068/131] Backport PR #29148: Don't fail on equal-but-differently-named cmaps in qt figureoptions. --- lib/matplotlib/backends/qt_editor/figureoptions.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/matplotlib/backends/qt_editor/figureoptions.py b/lib/matplotlib/backends/qt_editor/figureoptions.py index c36bbeb62641..3c2eaf1bacd3 100644 --- a/lib/matplotlib/backends/qt_editor/figureoptions.py +++ b/lib/matplotlib/backends/qt_editor/figureoptions.py @@ -149,7 +149,7 @@ def prepare_data(d, init): cmaps = [(cmap, name) for name, cmap in sorted(cm._colormaps.items())] for label, mappable in labeled_mappables: cmap = mappable.get_cmap() - if cmap not in cm._colormaps.values(): + if cmap.name not in cm._colormaps: cmaps = [(cmap, cmap.name), *cmaps] low, high = mappable.get_clim() mappabledata = [ From 4997d5e950d7713828d1ea26cc0b92920e407965 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Fri, 22 Nov 2024 21:50:55 -0500 Subject: [PATCH 069/131] Backport PR #29148: Don't fail on equal-but-differently-named cmaps in qt figureoptions. --- lib/matplotlib/backends/qt_editor/figureoptions.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/matplotlib/backends/qt_editor/figureoptions.py b/lib/matplotlib/backends/qt_editor/figureoptions.py index 2809e63c4e8c..9d31fa9ced2c 100644 --- a/lib/matplotlib/backends/qt_editor/figureoptions.py +++ b/lib/matplotlib/backends/qt_editor/figureoptions.py @@ -149,7 +149,7 @@ def prepare_data(d, init): cmaps = [(cmap, name) for name, cmap in sorted(cm._colormaps.items())] for label, mappable in labeled_mappables: cmap = mappable.get_cmap() - if cmap not in cm._colormaps.values(): + if cmap.name not in cm._colormaps: cmaps = [(cmap, cmap.name), *cmaps] low, high = mappable.get_clim() mappabledata = [ From dd5777232d288970697f4effafd38946d541784c Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Wed, 20 Nov 2024 23:48:23 -0500 Subject: [PATCH 070/131] Backport PR #29163: ci: Remove outdated pkg-config package on macOS --- .github/workflows/tests.yml | 2 ++ azure-pipelines.yml | 2 ++ 2 files changed, 4 insertions(+) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 6d2fe41546f1..6f604db8cd0b 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -202,6 +202,8 @@ jobs: brew unlink ${python_package} brew link --overwrite ${python_package} done + # Workaround for https://github.com/actions/runner-images/issues/10984 + brew uninstall --ignore-dependencies --force pkg-config@0.29.2 brew install ccache ghostscript gobject-introspection gtk4 ninja brew install --cask font-noto-sans-cjk inkscape ;; diff --git a/azure-pipelines.yml b/azure-pipelines.yml index e2829ce81e9f..00edc8e9a412 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -131,6 +131,8 @@ stages: brew unlink ${python_package} brew link --overwrite ${python_package} done + # Workaround for https://github.com/actions/runner-images/issues/10984 + brew uninstall --ignore-dependencies --force pkg-config@0.29.2 brew install --cask xquartz brew install ccache ffmpeg imagemagick mplayer ninja pkg-config brew install --cask font-noto-sans-cjk-sc From bdf5514fb0c3ee49cbb1cdf66834dab7a2c58c46 Mon Sep 17 00:00:00 2001 From: Victor Liu Date: Sat, 23 Nov 2024 14:30:11 -0500 Subject: [PATCH 071/131] added test cases for the modification to art3d.py --- lib/mpl_toolkits/mplot3d/tests/test_art3d.py | 31 +++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/lib/mpl_toolkits/mplot3d/tests/test_art3d.py b/lib/mpl_toolkits/mplot3d/tests/test_art3d.py index 4ed48aae4685..bb791f68343e 100644 --- a/lib/mpl_toolkits/mplot3d/tests/test_art3d.py +++ b/lib/mpl_toolkits/mplot3d/tests/test_art3d.py @@ -3,7 +3,7 @@ import matplotlib.pyplot as plt from matplotlib.backend_bases import MouseEvent -from mpl_toolkits.mplot3d.art3d import Line3DCollection +from mpl_toolkits.mplot3d.art3d import Line3DCollection, Poly3DCollection def test_scatter_3d_projection_conservation(): @@ -54,3 +54,32 @@ def test_zordered_error(): ax.add_collection(Line3DCollection(lc)) ax.scatter(*pc, visible=False) plt.draw() + + +def test_generate_normals(): + + # Following code is an example taken from + # https://stackoverflow.com/questions/18897786/transparency-for-poly3dcollection-plot-in-matplotlib + # and modified to test _generate_normals function + + fig = plt.figure() + ax = fig.add_subplot(111, projection='3d') + + x = [0, 2, 1, 1] + y = [0, 0, 1, 0] + z = [0, 0, 0, 1] + + # deliberately use nested tuple + vertices = ((0, 1, 2), (0, 1, 3), (0, 2, 3), (1, 2, 3)) + + tupleList = list(zip(x, y, z)) + + poly3d = [[tupleList[vertices[ix][iy]] for iy in range(len(vertices[0]))] + for ix in range(len(vertices))] + ax.scatter(x, y, z) + collection = Poly3DCollection(poly3d, alpha=0.2, edgecolors='r', shade=True) + face_color = [0.5, 0.5, 1] # alternative: matplotlib.colors.rgb2hex([0.5, 0.5, 1]) + collection.set_facecolor(face_color) + ax.add_collection3d(collection) + + plt.draw() From a0462e23339a779125b1f718759ccedbe4f91703 Mon Sep 17 00:00:00 2001 From: Tim Hoffmann <2836374+timhoffm@users.noreply.github.com> Date: Mon, 25 Nov 2024 16:11:53 +0100 Subject: [PATCH 072/131] Backport PR #28335: DOC: do not posting LLM output as your own work --- .github/ISSUE_TEMPLATE/bug_report.yml | 4 +++- .github/PULL_REQUEST_TEMPLATE.md | 5 +++++ doc/devel/contribute.rst | 15 +++++++++++++++ 3 files changed, 23 insertions(+), 1 deletion(-) diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml index 045386dc7402..0a57a3989265 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.yml +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -15,7 +15,9 @@ body: attributes: label: Code for reproduction description: >- - If possible, please provide a minimum self-contained example. + If possible, please provide a minimum self-contained example. If you + have used generative AI as an aid see + https://dev.matplotlib.org/devel/contributing.html#generative_ai. placeholder: Paste your code here. This field is automatically formatted as Python code. render: Python validations: diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index e857416b13d8..dbf9e5f4ae22 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -13,6 +13,11 @@ out the development guide https://matplotlib.org/devdocs/devel/index.html Additionally, please summarize the changes in the title, for example "Raise ValueError on non-numeric input to set_xlim" and avoid non-descriptive titles such as "Addresses issue #8576". + +If possible, please provide a minimum self-contained example. If you have used +generative AI as an aid in preparing this PR, see +https://dev.matplotlib.org/devel/contributing.html#generative_ai. + --> diff --git a/doc/devel/contribute.rst b/doc/devel/contribute.rst index 66057c76396f..0e7a9ef5115e 100644 --- a/doc/devel/contribute.rst +++ b/doc/devel/contribute.rst @@ -183,6 +183,21 @@ please cite us following the :doc:`/project/citing` guidelines. If you have developed an extension to Matplotlib, please consider adding it to our `third party package `_ list. + +.. _generative_ai: + + +Restrictions on Generative AI Usage +=================================== + +We expect authentic engagement in our community. Be wary of posting output +from Large Language Models or similar generative AI as comments on GitHub or +our discourse server, as such comments tend to be formulaic and low content. +If you use generative AI tools as an aid in developing code or documentation +changes, ensure that you fully understand the proposed changes and can explain +why they are the correct approach and an improvement to the current state. + + .. _new_contributors: New contributors From ea450746401d94b324fd4c0fe35ef3e802dc46b5 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Mon, 25 Nov 2024 21:02:08 -0500 Subject: [PATCH 073/131] Backport PR #28934: ci: Unpin micromamba again --- .appveyor.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.appveyor.yml b/.appveyor.yml index da2aec993979..2a641490520e 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -45,9 +45,8 @@ cache: init: - ps: - # Pinned due to https://github.com/mamba-org/mamba/issues/3467 Invoke-Webrequest - -URI https://github.com/mamba-org/micromamba-releases/releases/download/1.5.10-0/micromamba-win-64.tar.bz2 + -URI https://micro.mamba.pm/api/micromamba/win-64/latest -OutFile C:\projects\micromamba.tar.bz2 - ps: C:\PROGRA~1\7-Zip\7z.exe x C:\projects\micromamba.tar.bz2 -aoa -oC:\projects\ - ps: C:\PROGRA~1\7-Zip\7z.exe x C:\projects\micromamba.tar -ttar -aoa -oC:\projects\ @@ -55,6 +54,7 @@ init: - micromamba shell init --shell cmd.exe - micromamba config set always_yes true - micromamba config prepend channels conda-forge + - micromamba info install: - micromamba env create -f environment.yml python=%PYTHON_VERSION% pywin32 From 562d45862d411925f98b489270ea7a206a9a3bb1 Mon Sep 17 00:00:00 2001 From: Thomas A Caswell Date: Tue, 26 Nov 2024 10:14:08 -0500 Subject: [PATCH 074/131] Backport PR #29191: ci: Simplify 3.13t test setup --- .github/workflows/tests.yml | 20 +++----------------- 1 file changed, 3 insertions(+), 17 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 6f604db8cd0b..dc216c6959f0 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -126,11 +126,11 @@ jobs: allow-prereleases: true - name: Set up Python ${{ matrix.python-version }} - uses: deadsnakes/action@e640ac8743173a67cca4d7d77cd837e514bf98e8 # v3.2.0 + uses: Quansight-Labs/setup-python@b9ab292c751a42bcd2bb465b7fa202ea2c3f5796 # v5.3.1 if: matrix.python-version == '3.13t' with: - python-version: '3.13' - nogil: true + python-version: ${{ matrix.python-version }} + allow-prereleases: true - name: Install OS dependencies run: | @@ -177,11 +177,6 @@ jobs: texlive-luatex \ texlive-pictures \ texlive-xetex - if [[ "${{ matrix.python-version }}" = '3.13t' ]]; then - # TODO: Remove this once setup-python supports nogil distributions. - sudo apt-get install -yy --no-install-recommends \ - python3.13-tk-nogil - fi if [[ "${{ matrix.os }}" = ubuntu-20.04 ]]; then sudo apt-get install -yy --no-install-recommends libopengl0 else # ubuntu-22.04 @@ -245,15 +240,6 @@ jobs: 4-${{ runner.os }}-py${{ matrix.python-version }}-mpl-${{ github.ref }}- 4-${{ runner.os }}-py${{ matrix.python-version }}-mpl- - - name: Install the nightly dependencies - if: matrix.python-version == '3.13t' - run: | - python -m pip install pytz tzdata python-dateutil # Must be installed for Pandas. - python -m pip install \ - --pre \ - --index-url https://pypi.anaconda.org/scientific-python-nightly-wheels/simple \ - --upgrade --only-binary=:all: numpy pandas pillow contourpy - - name: Install Python dependencies run: | # Upgrade pip and setuptools and wheel to get as clean an install as From 3aabbb2554927932f91cc96c75ae35f243a9fc62 Mon Sep 17 00:00:00 2001 From: Thomas A Caswell Date: Tue, 26 Nov 2024 10:14:08 -0500 Subject: [PATCH 075/131] Backport PR #29191: ci: Simplify 3.13t test setup --- .github/workflows/tests.yml | 20 +++----------------- 1 file changed, 3 insertions(+), 17 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 52a6898cf7ca..5608cade2aa0 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -123,11 +123,11 @@ jobs: allow-prereleases: true - name: Set up Python ${{ matrix.python-version }} - uses: deadsnakes/action@e640ac8743173a67cca4d7d77cd837e514bf98e8 # v3.2.0 + uses: Quansight-Labs/setup-python@b9ab292c751a42bcd2bb465b7fa202ea2c3f5796 # v5.3.1 if: matrix.python-version == '3.13t' with: - python-version: '3.13' - nogil: true + python-version: ${{ matrix.python-version }} + allow-prereleases: true - name: Install OS dependencies run: | @@ -174,11 +174,6 @@ jobs: texlive-luatex \ texlive-pictures \ texlive-xetex - if [[ "${{ matrix.python-version }}" = '3.13t' ]]; then - # TODO: Remove this once setup-python supports nogil distributions. - sudo apt-get install -yy --no-install-recommends \ - python3.13-tk-nogil - fi if [[ "${{ matrix.os }}" = ubuntu-20.04 ]]; then sudo apt-get install -yy --no-install-recommends libopengl0 else # ubuntu-22.04 @@ -242,15 +237,6 @@ jobs: 4-${{ runner.os }}-py${{ matrix.python-version }}-mpl-${{ github.ref }}- 4-${{ runner.os }}-py${{ matrix.python-version }}-mpl- - - name: Install the nightly dependencies - if: matrix.python-version == '3.13t' - run: | - python -m pip install pytz tzdata python-dateutil # Must be installed for Pandas. - python -m pip install \ - --pre \ - --index-url https://pypi.anaconda.org/scientific-python-nightly-wheels/simple \ - --upgrade --only-binary=:all: numpy pandas pillow contourpy - - name: Install Python dependencies run: | # Upgrade pip and setuptools and wheel to get as clean an install as From 8e73c6db170401582017b600215372c46234df98 Mon Sep 17 00:00:00 2001 From: Kyle Sunden Date: Wed, 27 Nov 2024 15:09:03 -0600 Subject: [PATCH 076/131] Backport PR #29182: Update backend_qt.py: parent not passed to __init__ on subplottool --- lib/matplotlib/backends/backend_qt.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/matplotlib/backends/backend_qt.py b/lib/matplotlib/backends/backend_qt.py index 7a09d11f46f9..432bbb1ffdb6 100644 --- a/lib/matplotlib/backends/backend_qt.py +++ b/lib/matplotlib/backends/backend_qt.py @@ -856,7 +856,7 @@ def set_history_buttons(self): class SubplotToolQt(QtWidgets.QDialog): def __init__(self, targetfig, parent): - super().__init__() + super().__init__(parent) self.setWindowIcon(QtGui.QIcon( str(cbook._get_data_path("images/matplotlib.png")))) self.setObjectName("SubplotTool") From 6b8eb4bff5220d9762a3d67b3d566c93f9f5152b Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Fri, 29 Nov 2024 23:47:37 -0500 Subject: [PATCH 077/131] Backport PR #29169: Minor fixes to text intro explainer --- galleries/users_explain/text/text_intro.py | 79 +++++++++++----------- 1 file changed, 38 insertions(+), 41 deletions(-) diff --git a/galleries/users_explain/text/text_intro.py b/galleries/users_explain/text/text_intro.py index 3b8a66f1c98e..29210021369c 100644 --- a/galleries/users_explain/text/text_intro.py +++ b/galleries/users_explain/text/text_intro.py @@ -8,8 +8,6 @@ Text in Matplotlib ================== -Introduction to plotting and working with text in Matplotlib. - Matplotlib has extensive text support, including support for mathematical expressions, truetype support for raster and vector outputs, newline separated text with arbitrary @@ -124,8 +122,8 @@ fig, ax = plt.subplots(figsize=(5, 3)) fig.subplots_adjust(bottom=0.15, left=0.2) ax.plot(x1, y1) -ax.set_xlabel('Time [s]') -ax.set_ylabel('Damped oscillation [V]') +ax.set_xlabel('Time (s)') +ax.set_ylabel('Damped oscillation (V)') plt.show() @@ -137,26 +135,26 @@ fig, ax = plt.subplots(figsize=(5, 3)) fig.subplots_adjust(bottom=0.15, left=0.2) ax.plot(x1, y1*10000) -ax.set_xlabel('Time [s]') -ax.set_ylabel('Damped oscillation [V]') +ax.set_xlabel('Time (s)') +ax.set_ylabel('Damped oscillation (V)') plt.show() # %% # If you want to move the labels, you can specify the *labelpad* keyword # argument, where the value is points (1/72", the same unit used to specify -# fontsizes). +# font sizes). fig, ax = plt.subplots(figsize=(5, 3)) fig.subplots_adjust(bottom=0.15, left=0.2) ax.plot(x1, y1*10000) -ax.set_xlabel('Time [s]') -ax.set_ylabel('Damped oscillation [V]', labelpad=18) +ax.set_xlabel('Time (s)') +ax.set_ylabel('Damped oscillation (V)', labelpad=18) plt.show() # %% -# Or, the labels accept all the `.Text` keyword arguments, including +# Alternatively, the labels accept all the `.Text` keyword arguments, including # *position*, via which we can manually specify the label positions. Here we # put the xlabel to the far left of the axis. Note, that the y-coordinate of # this position has no effect - to adjust the y-position we need to use the @@ -165,15 +163,15 @@ fig, ax = plt.subplots(figsize=(5, 3)) fig.subplots_adjust(bottom=0.15, left=0.2) ax.plot(x1, y1) -ax.set_xlabel('Time [s]', position=(0., 1e6), horizontalalignment='left') -ax.set_ylabel('Damped oscillation [V]') +ax.set_xlabel('Time (s)', position=(0., 1e6), horizontalalignment='left') +ax.set_ylabel('Damped oscillation (V)') plt.show() # %% # All the labelling in this tutorial can be changed by manipulating the # `matplotlib.font_manager.FontProperties` method, or by named keyword -# arguments to `~matplotlib.axes.Axes.set_xlabel` +# arguments to `~matplotlib.axes.Axes.set_xlabel`. from matplotlib.font_manager import FontProperties @@ -182,8 +180,8 @@ fig, ax = plt.subplots(figsize=(5, 3)) fig.subplots_adjust(bottom=0.15, left=0.2) ax.plot(x1, y1) -ax.set_xlabel('Time [s]', fontsize='large', fontweight='bold') -ax.set_ylabel('Damped oscillation [V]', fontproperties=font) +ax.set_xlabel('Time (s)', fontsize='large', fontweight='bold') +ax.set_ylabel('Damped oscillation (V)', fontproperties=font) plt.show() @@ -194,8 +192,8 @@ fig, ax = plt.subplots(figsize=(5, 3)) fig.subplots_adjust(bottom=0.2, left=0.2) ax.plot(x1, np.cumsum(y1**2)) -ax.set_xlabel('Time [s] \n This was a long experiment') -ax.set_ylabel(r'$\int\ Y^2\ dt\ \ [V^2 s]$') +ax.set_xlabel('Time (s) \n This was a long experiment') +ax.set_ylabel(r'$\int\ Y^2\ dt\ \ (V^2 s)$') plt.show() @@ -204,14 +202,14 @@ # ====== # # Subplot titles are set in much the same way as labels, but there is -# the *loc* keyword arguments that can change the position and justification -# from the default value of ``loc=center``. +# the *loc* keyword argument that can change the position and justification +# (the default value is "center"). fig, axs = plt.subplots(3, 1, figsize=(5, 6), tight_layout=True) locs = ['center', 'left', 'right'] for ax, loc in zip(axs, locs): ax.plot(x1, y1) - ax.set_title('Title with loc at '+loc, loc=loc) + ax.set_title('Title with loc at ' + loc, loc=loc) plt.show() # %% @@ -237,7 +235,7 @@ # Terminology # ^^^^^^^^^^^ # -# *Axes* have an `matplotlib.axis.Axis` object for the ``ax.xaxis`` and +# *Axes* have a `matplotlib.axis.Axis` object for the ``ax.xaxis`` and # ``ax.yaxis`` that contain the information about how the labels in the axis # are laid out. # @@ -255,9 +253,9 @@ # # It is often convenient to simply define the # tick values, and sometimes the tick labels, overriding the default -# locators and formatters. This is discouraged because it breaks interactive -# navigation of the plot. It also can reset the axis limits: note that -# the second plot has the ticks we asked for, including ones that are +# locators and formatters. However, this is discouraged because it breaks +# interactive navigation of the plot. It also can reset the axis limits: note +# that the second plot has the ticks we asked for, including ones that are # well outside the automatic view limits. fig, axs = plt.subplots(2, 1, figsize=(5, 3), tight_layout=True) @@ -283,7 +281,7 @@ plt.show() # %% -# Tick Locators and Formatters +# Tick locators and formatters # ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ # # Instead of making a list of all the ticklabels, we could have @@ -317,14 +315,14 @@ # %% # The default formatter is the `matplotlib.ticker.MaxNLocator` called as -# ``ticker.MaxNLocator(self, nbins='auto', steps=[1, 2, 2.5, 5, 10])`` -# The *steps* keyword contains a list of multiples that can be used for -# tick values. i.e. in this case, 2, 4, 6 would be acceptable ticks, +# ``ticker.MaxNLocator(self, nbins='auto', steps=[1, 2, 2.5, 5, 10])``. +# The ``steps`` argument contains a list of multiples that can be used for +# tick values. In this case, 2, 4, 6 would be acceptable ticks, # as would 20, 40, 60 or 0.2, 0.4, 0.6. However, 3, 6, 9 would not be # acceptable because 3 doesn't appear in the list of steps. # -# ``nbins=auto`` uses an algorithm to determine how many ticks will -# be acceptable based on how long the axis is. The fontsize of the +# Setting ``nbins=auto`` uses an algorithm to determine how many ticks will +# be acceptable based on the axis length. The fontsize of the # ticklabel is taken into account, but the length of the tick string # is not (because it's not yet known.) In the bottom row, the # ticklabels are quite large, so we set ``nbins=4`` to make the @@ -382,11 +380,11 @@ def formatoddticks(x, pos): # Matplotlib can accept `datetime.datetime` and `numpy.datetime64` # objects as plotting arguments. Dates and times require special # formatting, which can often benefit from manual intervention. In -# order to help, dates have special Locators and Formatters, +# order to help, dates have special locators and formatters, # defined in the `matplotlib.dates` module. # -# A simple example is as follows. Note how we have to rotate the -# tick labels so that they don't over-run each other. +# The following simple example illustrates this concept. Note how we +# rotate the tick labels so that they don't overlap. import datetime @@ -399,11 +397,10 @@ def formatoddticks(x, pos): plt.show() # %% -# We can pass a format to `matplotlib.dates.DateFormatter`. Also note that the -# 29th and the next month are very close together. We can fix this by using -# the `.dates.DayLocator` class, which allows us to specify a list of days of -# the month to use. Similar formatters are listed in the `matplotlib.dates` -# module. +# We can pass a format to `matplotlib.dates.DateFormatter`. If two tick labels +# are very close together, we can use the `.dates.DayLocator` class, which +# allows us to specify a list of days of the month to use. Similar formatters +# are listed in the `matplotlib.dates` module. import matplotlib.dates as mdates @@ -418,9 +415,9 @@ def formatoddticks(x, pos): plt.show() # %% -# Legends and Annotations +# Legends and annotations # ======================= # -# - Legends: :ref:`legend_guide` -# - Annotations: :ref:`annotations` +# - :ref:`legend_guide` +# - :ref:`annotations` # From 4ca8d68b6b161b41492fb27c2431c3adc4d26051 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Sat, 30 Nov 2024 03:28:23 -0500 Subject: [PATCH 078/131] DOC: Create release notes for 3.9.3 --- doc/users/github_stats.rst | 156 ++++++++++-------- .../prev_whats_new/github_stats_3.9.2.rst | 96 +++++++++++ doc/users/release_notes.rst | 1 + 3 files changed, 181 insertions(+), 72 deletions(-) create mode 100644 doc/users/prev_whats_new/github_stats_3.9.2.rst diff --git a/doc/users/github_stats.rst b/doc/users/github_stats.rst index d357a6759d30..bec073081a68 100644 --- a/doc/users/github_stats.rst +++ b/doc/users/github_stats.rst @@ -1,99 +1,111 @@ .. _github-stats: -GitHub statistics for 3.9.2 (Aug 12, 2024) +GitHub statistics for 3.9.3 (Nov 30, 2024) ========================================== -GitHub statistics for 2024/07/04 (tag: v3.9.1) - 2024/08/12 +GitHub statistics for 2024/08/12 (tag: v3.9.2) - 2024/11/30 These lists are automatically generated, and may be incomplete or contain duplicates. -We closed 9 issues and merged 45 pull requests. -The full list can be seen `on GitHub `__ +We closed 6 issues and merged 62 pull requests. +The full list can be seen `on GitHub `__ -The following 20 authors contributed 67 commits. +The following 18 authors contributed 90 commits. -* Adam J. Stewart -* Anthony Lee -* Caitlin Hathaway -* ClarkeAC +* Andresporcruz +* Antony Lee +* Charlie LeWarne * dependabot[bot] * Elliott Sales de Andrade -* Filippo Balzaretti +* Gavin S * Greg Lucas * hannah -* Ian Thomas -* Jody Klymak * Kyle Sunden +* Kyra Cho +* kyracho +* Lumberbot (aka Jack) +* Michael Hinton * Oscar Gustafsson -* Randolf Scholz -* Refael Ackermann * Ruth Comer -* Scott Shambaugh -* Sean Smith * Thomas A Caswell * Tim Hoffmann +* vittoboa GitHub issues and pull requests: -Pull Requests (45): +Pull Requests (62): -* :ghpull:`28687`: BLD: Include MSVCP140 runtime statically -* :ghpull:`28679`: Run delvewheel with path to required msvcp140.dll -* :ghpull:`28695`: Backport PR #27797 on branch v3.9.x (DOC: Use video files for saving animations) -* :ghpull:`28688`: Backport PR #28293 and #28668: Enable 3.13 wheels and bump cibuildwheel -* :ghpull:`27797`: DOC: Use video files for saving animations -* :ghpull:`28692`: Backport PR #28632 on branch v3.9.x (DOC: Tell sphinx-gallery to link mpl_toolkits from our build) -* :ghpull:`28632`: DOC: Tell sphinx-gallery to link mpl_toolkits from our build -* :ghpull:`28668`: Bump the actions group with 2 updates -* :ghpull:`28686`: Backport PR #28682 on branch v3.9.x (Fix warnings from mingw compilers) -* :ghpull:`28682`: Fix warnings from mingw compilers -* :ghpull:`28676`: Backport PR #28577 on branch v3.9.x (Copy all internals from initial Tick to lazy ones) -* :ghpull:`28577`: Copy all internals from initial Tick to lazy ones -* :ghpull:`28674`: Backport PR #28650 on branch v3.9.x (remove out of date todos on animation.py) -* :ghpull:`28650`: remove out of date todos on animation.py -* :ghpull:`28656`: Backport PR #28649 on branch v3.9.x (FIX: improve formatting of image values in cases of singular norms) -* :ghpull:`28665`: Backport PR #28546 on branch v3.9.x (DOC: Clarify/simplify example of multiple images with one colorbar) -* :ghpull:`28649`: FIX: improve formatting of image values in cases of singular norms -* :ghpull:`28635`: BLD: windows wheels -* :ghpull:`28645`: Backport PR #28644 on branch v3.9.x (DOC: Fix matching for version switcher) -* :ghpull:`28640`: Backport PR #28634 on branch v3.9.x (Closed open div tag in color.ColorMap._repr_html_) -* :ghpull:`28634`: Closed open div tag in color.ColorMap._repr_html_ -* :ghpull:`28636`: Backport PR #28625 on branch v3.9.x (added typing_extensions.Self to _AxesBase.twinx) -* :ghpull:`28625`: added typing_extensions.Self to _AxesBase.twinx -* :ghpull:`28622`: Backport PR #28621 on branch v3.9.x (TYP: Fix a typo in animation.pyi) -* :ghpull:`28621`: TYP: Fix a typo in animation.pyi -* :ghpull:`28605`: Backport PR #28604 on branch v3.9.x (cycler signature update.) -* :ghpull:`28604`: cycler signature update. -* :ghpull:`28598`: Pin PyQt6 back on Ubuntu 20.04 -* :ghpull:`28596`: Backport PR #28518 on branch v3.9.x ([TYP] Fix overload of ``pyplot.subplots``) -* :ghpull:`28518`: [TYP] Fix overload of ``pyplot.subplots`` -* :ghpull:`28591`: Backport PR #28580 on branch v3.9.x (Bump actions/attest-build-provenance from 1.3.2 to 1.3.3 in the actions group) -* :ghpull:`28580`: Bump actions/attest-build-provenance from 1.3.2 to 1.3.3 in the actions group -* :ghpull:`28586`: Backport PR #28582 on branch v3.9.x (FIX: make sticky edge tolerance relative to data range) -* :ghpull:`28582`: FIX: make sticky edge tolerance relative to data range -* :ghpull:`28572`: Backport PR #28571 on branch v3.9.x (DOC: Add version directive to hatch parameter in stackplot) -* :ghpull:`28571`: DOC: Add version directive to hatch parameter in stackplot -* :ghpull:`28564`: Backport PR #28534 on branch v3.9.x ([BLD] Fix WSL build warning) -* :ghpull:`28563`: Backport PR #28526 on branch v3.9.x (Bump pypa/cibuildwheel from 2.19.1 to 2.19.2 in the actions group) -* :ghpull:`28534`: [BLD] Fix WSL build warning -* :ghpull:`28526`: Bump pypa/cibuildwheel from 2.19.1 to 2.19.2 in the actions group -* :ghpull:`28552`: Backport PR #28541 on branch v3.9.x (MNT: be more careful about disk I/O failures when writing font cache) -* :ghpull:`28541`: MNT: be more careful about disk I/O failures when writing font cache -* :ghpull:`28524`: Backport PR #28523 on branch v3.9.x (Fix value error when set widget size to zero while using FigureCanvasQT ) -* :ghpull:`28523`: Fix value error when set widget size to zero while using FigureCanvasQT -* :ghpull:`28519`: Backport PR #28517 on branch v3.9.x (DOC: better cross referencing for animations) +* :ghpull:`29195`: Backport PR #29191 on branch v3.9.x (ci: Simplify 3.13t test setup) +* :ghpull:`29191`: ci: Simplify 3.13t test setup +* :ghpull:`29176`: Backport PR #29148 on branch v3.9.x (Don't fail on equal-but-differently-named cmaps in qt figureoptions.) +* :ghpull:`29148`: Don't fail on equal-but-differently-named cmaps in qt figureoptions. +* :ghpull:`29165`: Backport PR #29153 on branch v3.9.x (Bump codecov/codecov-action from 4 to 5 in the actions group) +* :ghpull:`29153`: Bump codecov/codecov-action from 4 to 5 in the actions group +* :ghpull:`29149`: Backport CI config updates to v3.9.x +* :ghpull:`29121`: Backport PR #29120 on branch v3.9.x (DOC: Switch nested pie example from cmaps to color_sequences) +* :ghpull:`29071`: Bump pypa/gh-action-pypi-publish from 1.10.3 to 1.11.0 in the actions group +* :ghpull:`29046`: Backport PR #28981 on branch v3.9.x (FIX: macos: Use standard NSApp run loop in our input hook) +* :ghpull:`28981`: FIX: macos: Use standard NSApp run loop in our input hook +* :ghpull:`29041`: Backport PR #29035 on branch v3.9.x (FIX: Don't set_wmclass on GTK3) +* :ghpull:`29035`: FIX: Don't set_wmclass on GTK3 +* :ghpull:`29037`: Backport PR #29036 on branch v3.9.x (Don't pass redundant inline=True to example clabel() calls.) +* :ghpull:`29032`: Backport PR #27569 on branch v3.9.x (DOC: initial tags for statistics section of gallery) +* :ghpull:`29034`: Backport PR #29031 on branch v3.9.x (DOC: Fix copy-paste typo in ColorSequenceRegistry) +* :ghpull:`29031`: DOC: Fix copy-paste typo in ColorSequenceRegistry +* :ghpull:`29015`: Backport PR #29014 on branch v3.9.x (FIX: fake out setuptools scm in tox on ci) +* :ghpull:`29014`: FIX: fake out setuptools scm in tox on ci +* :ghpull:`29010`: Backport PR #29005 on branch v3.9.x (DOC: Update meson-python intersphinx link) +* :ghpull:`29006`: Backport PR #28993 on branch v3.9.x (FIX: contourf hatches use multiple edgecolors) +* :ghpull:`28993`: FIX: contourf hatches use multiple edgecolors +* :ghpull:`28988`: Backport PR #28987 on branch v3.9.x (Fix: Do not use numeric tolerances for axline special cases) +* :ghpull:`28947`: Backport PR #28925 on branch v3.9.x (TST: handle change in pytest.importorskip behavior) +* :ghpull:`28989`: Backport PR #28972 on branch v3.9.x (Switch macOS 12 runner images to macOS 13) +* :ghpull:`28972`: Switch macOS 12 runner images to macOS 13 +* :ghpull:`28987`: Fix: Do not use numeric tolerances for axline special cases +* :ghpull:`28954`: Backport PR #28952 on branch v3.9.x (BLD: update trove metadata to support py3.13) +* :ghpull:`28952`: BLD: update trove metadata to support py3.13 +* :ghpull:`28887`: Backport PR #28883 on branch v3.9.x (Only check X11 when running Tkinter tests) +* :ghpull:`28926`: Backport PR #28689 on branch v3.9.x (ci: Enable testing on Python 3.13) +* :ghpull:`28925`: TST: handle change in pytest.importorskip behavior +* :ghpull:`28945`: Backport PR #28943 on branch v3.9.x (DOC: Clarify the returned line of axhline()/axvline()) +* :ghpull:`28939`: Backport PR #28900 on branch v3.9.x (DOC: Improve fancybox demo) +* :ghpull:`28900`: DOC: Improve fancybox demo +* :ghpull:`28902`: Backport PR #28881 on branch v3.9.x (Fix ``axline`` for slopes <= 1E-8. Closes #28386) +* :ghpull:`28431`: Fix ``axline`` for slopes < 1E-8 +* :ghpull:`28881`: Fix ``axline`` for slopes <= 1E-8. Closes #28386 +* :ghpull:`28883`: Only check X11 when running Tkinter tests +* :ghpull:`28859`: Backport PR #28858 on branch v3.9.x (Fix flaky labelcolor tests) +* :ghpull:`28858`: Fix flaky labelcolor tests +* :ghpull:`28839`: Backport PR #28836 on branch v3.9.x (MNT: Use __init__ parameters of font properties) +* :ghpull:`28836`: MNT: Use __init__ parameters of font properties +* :ghpull:`28828`: Backport PR #28818 on branch v3.9.x (Resolve configdir so that it's not a symlink when is_dir() is called) +* :ghpull:`28818`: Resolve configdir so that it's not a symlink when is_dir() is called +* :ghpull:`28811`: Backport PR #28810 on branch v3.9.x (Document how to obtain sans-serif usetex math.) +* :ghpull:`28806`: Backport PR #28805 on branch v3.9.x (add brackets to satisfy the new sequence requirement) +* :ghpull:`28802`: Backport PR #28798 on branch v3.9.x (DOC: Correctly list modules that have been internalized) +* :ghpull:`28791`: Backport PR #28790 on branch v3.9.x (DOC: Fix duplicate Figure.set_dpi entry) +* :ghpull:`28787`: Backport PR #28706 on branch v3.9.x (Add Returns info to to_jshtml docstring) +* :ghpull:`28706`: Add Returns info to to_jshtml docstring +* :ghpull:`28751`: Backport PR #28271 on branch v3.9.x (Fix draggable legend disappearing when picking while use_blit=True) +* :ghpull:`28271`: Fix draggable legend disappearing when picking while use_blit=True +* :ghpull:`28747`: Backport PR #28743 on branch v3.9.x (Minor fixes in ticker docs) +* :ghpull:`28743`: Minor fixes in ticker docs +* :ghpull:`28738`: Backport PR #28737 on branch v3.9.x (TST: Fix image comparison directory for test_striped_lines) +* :ghpull:`28740`: Backport PR #28739 on branch v3.9.x (Tweak interactivity docs wording (and fix capitalization).) +* :ghpull:`28737`: TST: Fix image comparison directory for test_striped_lines +* :ghpull:`28733`: Backport PR #28732 on branch v3.9.x (Renames the minumumSizeHint method to minimumSizeHint) +* :ghpull:`28732`: Renames the minumumSizeHint method to minimumSizeHint +* :ghpull:`28689`: ci: Enable testing on Python 3.13 +* :ghpull:`28724`: Backport fixes from #28711 -Issues (9): +Issues (6): -* :ghissue:`28551`: [Bug]: Possible issue with Matplotlib 3.9.1 wheel on Windows only -* :ghissue:`28250`: [Doc]: Sphinx gallery links mispointed for Axes3D methods -* :ghissue:`28574`: [Bug]: Nondeterministic behavior with subplot spacing and constrained layout -* :ghissue:`28626`: [Doc]: Remove old TODO's from animation.py -* :ghissue:`28648`: [Bug]: format_image_data on an image of only zeros produces a large number of zeros -* :ghissue:`28624`: [Bug]: Bad type hint in ``_AxesBase.twinx()`` -* :ghissue:`28567`: [Bug]: sticky edge related changes for datetime plots -* :ghissue:`28533`: [Doc]: Stackplot hatch functionality has version dependencies -* :ghissue:`28538`: [Bug]: Permission denied when importing matplotlib.pyplot +* :ghissue:`28960`: [Bug]: High CPU utilization of the macosx backend +* :ghissue:`28990`: [Bug]: no longer able to set multiple hatch colors +* :ghissue:`28870`: [Bug]: axline doesn't work with some axes scales +* :ghissue:`28386`: [Bug]: Minor issue - Drawing an axline sets slopes less than 1E-8 to 0 +* :ghissue:`28817`: [Bug]: ``~/.config/matplotlib`` is never used because ``~/.config`` is a symlink +* :ghissue:`28716`: Size hint method in Qt backend should be named ``minimumSizeHint``, not ``minumumSizeHint`` Previous GitHub statistics diff --git a/doc/users/prev_whats_new/github_stats_3.9.2.rst b/doc/users/prev_whats_new/github_stats_3.9.2.rst new file mode 100644 index 000000000000..542e0d81ce32 --- /dev/null +++ b/doc/users/prev_whats_new/github_stats_3.9.2.rst @@ -0,0 +1,96 @@ +.. _github-stats-3-9-2: + +GitHub statistics for 3.9.2 (Aug 12, 2024) +========================================== + +GitHub statistics for 2024/07/04 (tag: v3.9.1) - 2024/08/12 + +These lists are automatically generated, and may be incomplete or contain duplicates. + +We closed 9 issues and merged 45 pull requests. +The full list can be seen `on GitHub `__ + +The following 20 authors contributed 67 commits. + +* Adam J. Stewart +* Anthony Lee +* Caitlin Hathaway +* ClarkeAC +* dependabot[bot] +* Elliott Sales de Andrade +* Filippo Balzaretti +* Greg Lucas +* hannah +* Ian Thomas +* Jody Klymak +* Kyle Sunden +* Oscar Gustafsson +* Randolf Scholz +* Refael Ackermann +* Ruth Comer +* Scott Shambaugh +* Sean Smith +* Thomas A Caswell +* Tim Hoffmann + +GitHub issues and pull requests: + +Pull Requests (45): + +* :ghpull:`28687`: BLD: Include MSVCP140 runtime statically +* :ghpull:`28679`: Run delvewheel with path to required msvcp140.dll +* :ghpull:`28695`: Backport PR #27797 on branch v3.9.x (DOC: Use video files for saving animations) +* :ghpull:`28688`: Backport PR #28293 and #28668: Enable 3.13 wheels and bump cibuildwheel +* :ghpull:`27797`: DOC: Use video files for saving animations +* :ghpull:`28692`: Backport PR #28632 on branch v3.9.x (DOC: Tell sphinx-gallery to link mpl_toolkits from our build) +* :ghpull:`28632`: DOC: Tell sphinx-gallery to link mpl_toolkits from our build +* :ghpull:`28668`: Bump the actions group with 2 updates +* :ghpull:`28686`: Backport PR #28682 on branch v3.9.x (Fix warnings from mingw compilers) +* :ghpull:`28682`: Fix warnings from mingw compilers +* :ghpull:`28676`: Backport PR #28577 on branch v3.9.x (Copy all internals from initial Tick to lazy ones) +* :ghpull:`28577`: Copy all internals from initial Tick to lazy ones +* :ghpull:`28674`: Backport PR #28650 on branch v3.9.x (remove out of date todos on animation.py) +* :ghpull:`28650`: remove out of date todos on animation.py +* :ghpull:`28656`: Backport PR #28649 on branch v3.9.x (FIX: improve formatting of image values in cases of singular norms) +* :ghpull:`28665`: Backport PR #28546 on branch v3.9.x (DOC: Clarify/simplify example of multiple images with one colorbar) +* :ghpull:`28649`: FIX: improve formatting of image values in cases of singular norms +* :ghpull:`28635`: BLD: windows wheels +* :ghpull:`28645`: Backport PR #28644 on branch v3.9.x (DOC: Fix matching for version switcher) +* :ghpull:`28640`: Backport PR #28634 on branch v3.9.x (Closed open div tag in color.ColorMap._repr_html_) +* :ghpull:`28634`: Closed open div tag in color.ColorMap._repr_html_ +* :ghpull:`28636`: Backport PR #28625 on branch v3.9.x (added typing_extensions.Self to _AxesBase.twinx) +* :ghpull:`28625`: added typing_extensions.Self to _AxesBase.twinx +* :ghpull:`28622`: Backport PR #28621 on branch v3.9.x (TYP: Fix a typo in animation.pyi) +* :ghpull:`28621`: TYP: Fix a typo in animation.pyi +* :ghpull:`28605`: Backport PR #28604 on branch v3.9.x (cycler signature update.) +* :ghpull:`28604`: cycler signature update. +* :ghpull:`28598`: Pin PyQt6 back on Ubuntu 20.04 +* :ghpull:`28596`: Backport PR #28518 on branch v3.9.x ([TYP] Fix overload of ``pyplot.subplots``) +* :ghpull:`28518`: [TYP] Fix overload of ``pyplot.subplots`` +* :ghpull:`28591`: Backport PR #28580 on branch v3.9.x (Bump actions/attest-build-provenance from 1.3.2 to 1.3.3 in the actions group) +* :ghpull:`28580`: Bump actions/attest-build-provenance from 1.3.2 to 1.3.3 in the actions group +* :ghpull:`28586`: Backport PR #28582 on branch v3.9.x (FIX: make sticky edge tolerance relative to data range) +* :ghpull:`28582`: FIX: make sticky edge tolerance relative to data range +* :ghpull:`28572`: Backport PR #28571 on branch v3.9.x (DOC: Add version directive to hatch parameter in stackplot) +* :ghpull:`28571`: DOC: Add version directive to hatch parameter in stackplot +* :ghpull:`28564`: Backport PR #28534 on branch v3.9.x ([BLD] Fix WSL build warning) +* :ghpull:`28563`: Backport PR #28526 on branch v3.9.x (Bump pypa/cibuildwheel from 2.19.1 to 2.19.2 in the actions group) +* :ghpull:`28534`: [BLD] Fix WSL build warning +* :ghpull:`28526`: Bump pypa/cibuildwheel from 2.19.1 to 2.19.2 in the actions group +* :ghpull:`28552`: Backport PR #28541 on branch v3.9.x (MNT: be more careful about disk I/O failures when writing font cache) +* :ghpull:`28541`: MNT: be more careful about disk I/O failures when writing font cache +* :ghpull:`28524`: Backport PR #28523 on branch v3.9.x (Fix value error when set widget size to zero while using FigureCanvasQT ) +* :ghpull:`28523`: Fix value error when set widget size to zero while using FigureCanvasQT +* :ghpull:`28519`: Backport PR #28517 on branch v3.9.x (DOC: better cross referencing for animations) + +Issues (9): + +* :ghissue:`28551`: [Bug]: Possible issue with Matplotlib 3.9.1 wheel on Windows only +* :ghissue:`28250`: [Doc]: Sphinx gallery links mispointed for Axes3D methods +* :ghissue:`28574`: [Bug]: Nondeterministic behavior with subplot spacing and constrained layout +* :ghissue:`28626`: [Doc]: Remove old TODO's from animation.py +* :ghissue:`28648`: [Bug]: format_image_data on an image of only zeros produces a large number of zeros +* :ghissue:`28624`: [Bug]: Bad type hint in ``_AxesBase.twinx()`` +* :ghissue:`28567`: [Bug]: sticky edge related changes for datetime plots +* :ghissue:`28533`: [Doc]: Stackplot hatch functionality has version dependencies +* :ghissue:`28538`: [Bug]: Permission denied when importing matplotlib.pyplot diff --git a/doc/users/release_notes.rst b/doc/users/release_notes.rst index 74bc0f13bf1f..010f9b7534bc 100644 --- a/doc/users/release_notes.rst +++ b/doc/users/release_notes.rst @@ -23,6 +23,7 @@ Version 3.9 ../api/prev_api_changes/api_changes_3.9.1.rst ../api/prev_api_changes/api_changes_3.9.0.rst github_stats.rst + prev_whats_new/github_stats_3.9.2.rst prev_whats_new/github_stats_3.9.1.rst prev_whats_new/github_stats_3.9.0.rst From 3ac0aea8be540028cb2510dabb43b290d15b503d Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Sat, 30 Nov 2024 03:33:58 -0500 Subject: [PATCH 079/131] REL: 3.9.3 This is the third bugfix release of the 3.9.x series. This release contains several bug-fixes and adjustments: - Fix `axline` with extremely small slopes - Fix `axline` with non-linear axis scales - Fix `minimumSizeHint` with Qt backend - Fix config directory usage when it's behind a symlink - Fix draggable legend when blitting is enabled - Fix high CPU utilization in the `macosx` backend - Fix multiple hatch `edgecolors` passed to `contourf` - Improve compatibility with `pytest` 8.2.0 From 4d1e3d247c3e6986f18623abfb7e9d4b6e4f46b2 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Sat, 30 Nov 2024 03:44:36 -0500 Subject: [PATCH 080/131] BLD: bump branch away from tag So the tarballs from GitHub are stable. From 81f69332d0d8071b62d0f9858f0b4559548d5973 Mon Sep 17 00:00:00 2001 From: Ruth Comer <10599679+rcomer@users.noreply.github.com> Date: Sat, 30 Nov 2024 19:12:32 +0000 Subject: [PATCH 081/131] Backport PR #29209: FIX: pcolormesh with no x y args and nearest interp --- lib/matplotlib/axes/_axes.py | 5 +---- lib/matplotlib/tests/test_axes.py | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/lib/matplotlib/axes/_axes.py b/lib/matplotlib/axes/_axes.py index af5173d2503e..a2e5c3ad5d8a 100644 --- a/lib/matplotlib/axes/_axes.py +++ b/lib/matplotlib/axes/_axes.py @@ -5928,10 +5928,7 @@ def _pcolorargs(self, funcname, *args, shading='auto', **kwargs): else: X, Y = np.meshgrid(np.arange(ncols + 1), np.arange(nrows + 1)) shading = 'flat' - C = cbook.safe_masked_invalid(C, copy=True) - return X, Y, C, shading - - if len(args) == 3: + elif len(args) == 3: # Check x and y for bad data... C = np.asanyarray(args[2]) # unit conversion allows e.g. datetime objects as axis values diff --git a/lib/matplotlib/tests/test_axes.py b/lib/matplotlib/tests/test_axes.py index ee6f715c3ccd..11490b605e22 100644 --- a/lib/matplotlib/tests/test_axes.py +++ b/lib/matplotlib/tests/test_axes.py @@ -1499,6 +1499,20 @@ def test_pcolormesh_rgba(fig_test, fig_ref, dims, alpha): ax.pcolormesh(c[..., 0], cmap="gray", vmin=0, vmax=1, alpha=alpha) +@check_figures_equal(extensions=["png"]) +def test_pcolormesh_nearest_noargs(fig_test, fig_ref): + x = np.arange(4) + y = np.arange(7) + X, Y = np.meshgrid(x, y) + C = X + Y + + ax = fig_test.subplots() + ax.pcolormesh(C, shading="nearest") + + ax = fig_ref.subplots() + ax.pcolormesh(x, y, C, shading="nearest") + + @image_comparison(['pcolormesh_datetime_axis.png'], style='mpl20') def test_pcolormesh_datetime_axis(): # Remove this line when this test image is regenerated. From 71c55ab77f0375816068dfff8424094bb0481c84 Mon Sep 17 00:00:00 2001 From: Lucx33 <104513017+Lucx33@users.noreply.github.com> Date: Sat, 30 Nov 2024 16:49:19 -0300 Subject: [PATCH 082/131] Backport PR #29133: Creating_parse_bar_color_args to unify color handling in plt.bar with precedence and sequence support for facecolor and edgecolor --- lib/matplotlib/axes/_axes.py | 69 +++++++++++++++++++++++++++---- lib/matplotlib/tests/test_axes.py | 25 +++++++++++ 2 files changed, 86 insertions(+), 8 deletions(-) diff --git a/lib/matplotlib/axes/_axes.py b/lib/matplotlib/axes/_axes.py index af5173d2503e..01b058a3ed7c 100644 --- a/lib/matplotlib/axes/_axes.py +++ b/lib/matplotlib/axes/_axes.py @@ -2321,6 +2321,56 @@ def _convert_dx(dx, x0, xconv, convert): dx = convert(dx) return dx + def _parse_bar_color_args(self, kwargs): + """ + Helper function to process color-related arguments of `.Axes.bar`. + + Argument precedence for facecolors: + + - kwargs['facecolor'] + - kwargs['color'] + - 'Result of ``self._get_patches_for_fill.get_next_color`` + + Argument precedence for edgecolors: + + - kwargs['edgecolor'] + - None + + Parameters + ---------- + self : Axes + + kwargs : dict + Additional kwargs. If these keys exist, we pop and process them: + 'facecolor', 'edgecolor', 'color' + Note: The dict is modified by this function. + + + Returns + ------- + facecolor + The facecolor. One or more colors as (N, 4) rgba array. + edgecolor + The edgecolor. Not normalized; may be any valid color spec or None. + """ + color = kwargs.pop('color', None) + + facecolor = kwargs.pop('facecolor', color) + edgecolor = kwargs.pop('edgecolor', None) + + facecolor = (facecolor if facecolor is not None + else self._get_patches_for_fill.get_next_color()) + + try: + facecolor = mcolors.to_rgba_array(facecolor) + except ValueError as err: + raise ValueError( + "'facecolor' or 'color' argument must be a valid color or" + "sequence of colors." + ) from err + + return facecolor, edgecolor + @_preprocess_data() @_docstring.interpd def bar(self, x, height, width=0.8, bottom=None, *, align="center", @@ -2376,7 +2426,12 @@ def bar(self, x, height, width=0.8, bottom=None, *, align="center", Other Parameters ---------------- color : :mpltype:`color` or list of :mpltype:`color`, optional + The colors of the bar faces. This is an alias for *facecolor*. + If both are given, *facecolor* takes precedence. + + facecolor : :mpltype:`color` or list of :mpltype:`color`, optional The colors of the bar faces. + If both *color* and *facecolor are given, *facecolor* takes precedence. edgecolor : :mpltype:`color` or list of :mpltype:`color`, optional The colors of the bar edges. @@ -2441,10 +2496,8 @@ def bar(self, x, height, width=0.8, bottom=None, *, align="center", bar. See :doc:`/gallery/lines_bars_and_markers/bar_stacked`. """ kwargs = cbook.normalize_kwargs(kwargs, mpatches.Patch) - color = kwargs.pop('color', None) - if color is None: - color = self._get_patches_for_fill.get_next_color() - edgecolor = kwargs.pop('edgecolor', None) + facecolor, edgecolor = self._parse_bar_color_args(kwargs) + linewidth = kwargs.pop('linewidth', None) hatch = kwargs.pop('hatch', None) @@ -2540,9 +2593,9 @@ def bar(self, x, height, width=0.8, bottom=None, *, align="center", linewidth = itertools.cycle(np.atleast_1d(linewidth)) hatch = itertools.cycle(np.atleast_1d(hatch)) - color = itertools.chain(itertools.cycle(mcolors.to_rgba_array(color)), - # Fallback if color == "none". - itertools.repeat('none')) + facecolor = itertools.chain(itertools.cycle(facecolor), + # Fallback if color == "none". + itertools.repeat('none')) if edgecolor is None: edgecolor = itertools.repeat(None) else: @@ -2576,7 +2629,7 @@ def bar(self, x, height, width=0.8, bottom=None, *, align="center", bottom = y patches = [] - args = zip(left, bottom, width, height, color, edgecolor, linewidth, + args = zip(left, bottom, width, height, facecolor, edgecolor, linewidth, hatch, patch_labels) for l, b, w, h, c, e, lw, htch, lbl in args: r = mpatches.Rectangle( diff --git a/lib/matplotlib/tests/test_axes.py b/lib/matplotlib/tests/test_axes.py index ee6f715c3ccd..0dded0515ba7 100644 --- a/lib/matplotlib/tests/test_axes.py +++ b/lib/matplotlib/tests/test_axes.py @@ -9451,3 +9451,28 @@ def test_wrong_use_colorizer(): for kwrd in kwrds: with pytest.raises(ValueError, match=match_str): fig.figimage(c, colorizer=cl, **kwrd) + + +def test_bar_color_precedence(): + # Test the precedence of 'color' and 'facecolor' in bar plots + fig, ax = plt.subplots() + + # case 1: no color specified + bars = ax.bar([1, 2, 3], [4, 5, 6]) + for bar in bars: + assert mcolors.same_color(bar.get_facecolor(), 'blue') + + # case 2: Only 'color' + bars = ax.bar([11, 12, 13], [4, 5, 6], color='red') + for bar in bars: + assert mcolors.same_color(bar.get_facecolor(), 'red') + + # case 3: Only 'facecolor' + bars = ax.bar([21, 22, 23], [4, 5, 6], facecolor='yellow') + for bar in bars: + assert mcolors.same_color(bar.get_facecolor(), 'yellow') + + # case 4: 'facecolor' and 'color' + bars = ax.bar([31, 32, 33], [4, 5, 6], color='red', facecolor='green') + for bar in bars: + assert mcolors.same_color(bar.get_facecolor(), 'green') From 1d7e71eafa2e9f22f605b0cd767165e38fb10a25 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Sun, 1 Dec 2024 00:42:34 -0500 Subject: [PATCH 083/131] DOC: Add Zenodo DOI for 3.9.3 --- doc/_static/zenodo_cache/14249941.svg | 35 +++++++++++++++++++++++++++ doc/project/citing.rst | 3 +++ tools/cache_zenodo_svg.py | 1 + 3 files changed, 39 insertions(+) create mode 100644 doc/_static/zenodo_cache/14249941.svg diff --git a/doc/_static/zenodo_cache/14249941.svg b/doc/_static/zenodo_cache/14249941.svg new file mode 100644 index 000000000000..f9165f17fdf0 --- /dev/null +++ b/doc/_static/zenodo_cache/14249941.svg @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + + + DOI + + + DOI + + + 10.5281/zenodo.14249941 + + + 10.5281/zenodo.14249941 + + + \ No newline at end of file diff --git a/doc/project/citing.rst b/doc/project/citing.rst index 38c989fca195..544c899da4d2 100644 --- a/doc/project/citing.rst +++ b/doc/project/citing.rst @@ -32,6 +32,9 @@ By version .. START OF AUTOGENERATED +v3.9.3 + .. image:: ../_static/zenodo_cache/14249941.svg + :target: https://doi.org/10.5281/zenodo.14249941 v3.9.2 .. image:: ../_static/zenodo_cache/13308876.svg :target: https://doi.org/10.5281/zenodo.13308876 diff --git a/tools/cache_zenodo_svg.py b/tools/cache_zenodo_svg.py index 40814d21573c..e1a5d3bcec48 100644 --- a/tools/cache_zenodo_svg.py +++ b/tools/cache_zenodo_svg.py @@ -63,6 +63,7 @@ def _get_xdg_cache_dir(): if __name__ == "__main__": data = { + "v3.9.3": "14249941", "v3.9.2": "13308876", "v3.9.1": "12652732", "v3.9.0": "11201097", From 9edcdae93ed172659d553a0e646a538d23fe9cf3 Mon Sep 17 00:00:00 2001 From: Tim Hoffmann <2836374+timhoffm@users.noreply.github.com> Date: Wed, 4 Dec 2024 08:50:05 +0100 Subject: [PATCH 084/131] Backport PR #29213: avoid-unnecessary-warning-in-_pcolorargs-function --- lib/matplotlib/axes/_axes.py | 14 +++++++++----- lib/matplotlib/tests/test_axes.py | 25 ++++++++++++++++++++++++- 2 files changed, 33 insertions(+), 6 deletions(-) diff --git a/lib/matplotlib/axes/_axes.py b/lib/matplotlib/axes/_axes.py index a2e5c3ad5d8a..b446802fdd74 100644 --- a/lib/matplotlib/axes/_axes.py +++ b/lib/matplotlib/axes/_axes.py @@ -5979,11 +5979,15 @@ def _pcolorargs(self, funcname, *args, shading='auto', **kwargs): # grid is specified at the center, so define corners # at the midpoints between the grid centers and then use the # flat algorithm. - def _interp_grid(X): - # helper for below + def _interp_grid(X, require_monotonicity=False): + # helper for below. To ensure the cell edges are calculated + # correctly, when expanding columns, the monotonicity of + # X coords needs to be checked. When expanding rows, the + # monotonicity of Y coords needs to be checked. if np.shape(X)[1] > 1: dX = np.diff(X, axis=1) * 0.5 - if not (np.all(dX >= 0) or np.all(dX <= 0)): + if (require_monotonicity and + not (np.all(dX >= 0) or np.all(dX <= 0))): _api.warn_external( f"The input coordinates to {funcname} are " "interpreted as cell centers, but are not " @@ -6003,11 +6007,11 @@ def _interp_grid(X): return X if ncols == Nx: - X = _interp_grid(X) + X = _interp_grid(X, require_monotonicity=True) Y = _interp_grid(Y) if nrows == Ny: X = _interp_grid(X.T).T - Y = _interp_grid(Y.T).T + Y = _interp_grid(Y.T, require_monotonicity=True).T shading = 'flat' C = cbook.safe_masked_invalid(C, copy=True) diff --git a/lib/matplotlib/tests/test_axes.py b/lib/matplotlib/tests/test_axes.py index 11490b605e22..8689336f71a4 100644 --- a/lib/matplotlib/tests/test_axes.py +++ b/lib/matplotlib/tests/test_axes.py @@ -1589,7 +1589,9 @@ def test_pcolorargs(): x = np.ma.array(x, mask=(x < 0)) with pytest.raises(ValueError): ax.pcolormesh(x, y, Z[:-1, :-1]) - # Expect a warning with non-increasing coordinates + # If the X or Y coords do not possess monotonicity in their respective + # directions, a warning indicating a bad grid will be triggered. + # The case of specifying coordinates by inputting 1D arrays. x = [359, 0, 1] y = [-10, 10] X, Y = np.meshgrid(x, y) @@ -1597,6 +1599,27 @@ def test_pcolorargs(): with pytest.warns(UserWarning, match='are not monotonically increasing or decreasing'): ax.pcolormesh(X, Y, Z, shading='auto') + # The case of specifying coordinates by inputting 2D arrays. + x = np.linspace(-1, 1, 3) + y = np.linspace(-1, 1, 3) + X, Y = np.meshgrid(x, y) + Z = np.zeros(X.shape) + np.random.seed(19680801) + noise_X = np.random.random(X.shape) + noise_Y = np.random.random(Y.shape) + with pytest.warns(UserWarning, + match='are not monotonically increasing or ' + 'decreasing') as record: + # Small perturbations in coordinates will not disrupt the monotonicity + # of the X-coords and Y-coords in their respective directions. + # Therefore, no warnings will be triggered. + ax.pcolormesh(X+noise_X, Y+noise_Y, Z, shading='auto') + assert len(record) == 0 + # Large perturbations have disrupted the monotonicity of the X-coords + # and Y-coords in their respective directions, thus resulting in two + # bad grid warnings. + ax.pcolormesh(X+10*noise_X, Y+10*noise_Y, Z, shading='auto') + assert len(record) == 2 def test_pcolormesh_underflow_error(): From aa6926b73edcb800b51f196f51cbfce2439f0619 Mon Sep 17 00:00:00 2001 From: Tim Hoffmann <2836374+timhoffm@users.noreply.github.com> Date: Wed, 4 Dec 2024 08:54:18 +0100 Subject: [PATCH 085/131] Backport PR #29206: Skip more tests on pure-Wayland systems --- lib/matplotlib/tests/test_backends_interactive.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/matplotlib/tests/test_backends_interactive.py b/lib/matplotlib/tests/test_backends_interactive.py index eb3557ae33f9..063c72e2cde7 100644 --- a/lib/matplotlib/tests/test_backends_interactive.py +++ b/lib/matplotlib/tests/test_backends_interactive.py @@ -78,7 +78,10 @@ def _get_available_interactive_backends(): missing = [dep for dep in deps if not importlib.util.find_spec(dep)] if missing: reason = "{} cannot be imported".format(", ".join(missing)) - elif env["MPLBACKEND"] == "tkagg" and _is_linux_and_xdisplay_invalid: + elif _is_linux_and_xdisplay_invalid and ( + env["MPLBACKEND"] == "tkagg" + # Remove when https://github.com/wxWidgets/Phoenix/pull/2638 is out. + or env["MPLBACKEND"].startswith("wx")): reason = "$DISPLAY is unset" elif _is_linux_and_display_invalid: reason = "$DISPLAY and $WAYLAND_DISPLAY are unset" @@ -452,6 +455,9 @@ def qt5_and_qt6_pairs(): yield from ([qt5, qt6], [qt6, qt5]) +@pytest.mark.skipif( + sys.platform == "linux" and not _c_internal_utils.display_is_valid(), + reason="$DISPLAY and $WAYLAND_DISPLAY are unset") @pytest.mark.parametrize('host, mpl', [*qt5_and_qt6_pairs()]) def test_cross_Qt_imports(host, mpl): try: From 5b5f3a6987a089dc0a17c57fa56f4ac6ca0e8b3d Mon Sep 17 00:00:00 2001 From: Kyle Sunden Date: Wed, 4 Dec 2024 15:31:45 -0600 Subject: [PATCH 086/131] Backport PR #29188: Bump pypa/cibuildwheel from 2.21.3 to 2.22.0 in the actions group --- .github/workflows/cibuildwheel.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/cibuildwheel.yml b/.github/workflows/cibuildwheel.yml index f88c4885ad48..a24bda296619 100644 --- a/.github/workflows/cibuildwheel.yml +++ b/.github/workflows/cibuildwheel.yml @@ -143,7 +143,7 @@ jobs: path: dist/ - name: Build wheels for CPython 3.13 - uses: pypa/cibuildwheel@7940a4c0e76eb2030e473a5f864f291f63ee879b # v2.21.3 + uses: pypa/cibuildwheel@ee63bf16da6cddfb925f542f2c7b59ad50e93969 # v2.22.0 with: package-dir: dist/${{ needs.build_sdist.outputs.SDIST_NAME }} env: @@ -161,7 +161,7 @@ jobs: CIBW_ARCHS: ${{ matrix.cibw_archs }} - name: Build wheels for CPython 3.12 - uses: pypa/cibuildwheel@7940a4c0e76eb2030e473a5f864f291f63ee879b # v2.21.3 + uses: pypa/cibuildwheel@ee63bf16da6cddfb925f542f2c7b59ad50e93969 # v2.22.0 with: package-dir: dist/${{ needs.build_sdist.outputs.SDIST_NAME }} env: @@ -169,7 +169,7 @@ jobs: CIBW_ARCHS: ${{ matrix.cibw_archs }} - name: Build wheels for CPython 3.11 - uses: pypa/cibuildwheel@7940a4c0e76eb2030e473a5f864f291f63ee879b # v2.21.3 + uses: pypa/cibuildwheel@ee63bf16da6cddfb925f542f2c7b59ad50e93969 # v2.22.0 with: package-dir: dist/${{ needs.build_sdist.outputs.SDIST_NAME }} env: @@ -177,7 +177,7 @@ jobs: CIBW_ARCHS: ${{ matrix.cibw_archs }} - name: Build wheels for CPython 3.10 - uses: pypa/cibuildwheel@7940a4c0e76eb2030e473a5f864f291f63ee879b # v2.21.3 + uses: pypa/cibuildwheel@ee63bf16da6cddfb925f542f2c7b59ad50e93969 # v2.22.0 with: package-dir: dist/${{ needs.build_sdist.outputs.SDIST_NAME }} env: @@ -185,7 +185,7 @@ jobs: CIBW_ARCHS: ${{ matrix.cibw_archs }} - name: Build wheels for PyPy - uses: pypa/cibuildwheel@7940a4c0e76eb2030e473a5f864f291f63ee879b # v2.21.3 + uses: pypa/cibuildwheel@ee63bf16da6cddfb925f542f2c7b59ad50e93969 # v2.22.0 with: package-dir: dist/${{ needs.build_sdist.outputs.SDIST_NAME }} env: From b0ae5d75196f30c727b73ff4c5ecb3d450d4f216 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Thu, 5 Dec 2024 15:45:13 -0500 Subject: [PATCH 087/131] Backport PR #29167: BUGFIX: use axes unit information in ConnectionPatch --- lib/matplotlib/category.py | 5 +++-- lib/matplotlib/patches.py | 14 +++++++++----- lib/matplotlib/tests/test_patches.py | 22 ++++++++++++++++++++++ lib/matplotlib/tests/test_units.py | 15 +++++++++++++++ 4 files changed, 49 insertions(+), 7 deletions(-) diff --git a/lib/matplotlib/category.py b/lib/matplotlib/category.py index 14cffd914a2a..225c837006f7 100644 --- a/lib/matplotlib/category.py +++ b/lib/matplotlib/category.py @@ -17,7 +17,7 @@ import numpy as np -from matplotlib import _api, ticker, units +from matplotlib import _api, cbook, ticker, units _log = logging.getLogger(__name__) @@ -55,7 +55,8 @@ def convert(value, unit, axis): values = np.atleast_1d(np.array(value, dtype=object)) # force an update so it also does type checking unit.update(values) - return np.vectorize(unit._mapping.__getitem__, otypes=[float])(values) + s = np.vectorize(unit._mapping.__getitem__, otypes=[float])(values) + return s if not cbook.is_scalar_or_string(value) else s[0] @staticmethod def axisinfo(unit, axis): diff --git a/lib/matplotlib/patches.py b/lib/matplotlib/patches.py index e7e56c853849..f47c8abee32d 100644 --- a/lib/matplotlib/patches.py +++ b/lib/matplotlib/patches.py @@ -4589,10 +4589,15 @@ def _get_xy(self, xy, s, axes=None): s0 = s # For the error message, if needed. if axes is None: axes = self.axes - xy = np.array(xy) + + # preserve mixed type input (such as str, int) + x = np.array(xy[0]) + y = np.array(xy[1]) + fig = self.get_figure(root=False) if s in ["figure points", "axes points"]: - xy *= fig.dpi / 72 + x = x * fig.dpi / 72 + y = y * fig.dpi / 72 s = s.replace("points", "pixels") elif s == "figure fraction": s = fig.transFigure @@ -4600,12 +4605,11 @@ def _get_xy(self, xy, s, axes=None): s = fig.transSubfigure elif s == "axes fraction": s = axes.transAxes - x, y = xy if s == 'data': trans = axes.transData - x = float(self.convert_xunits(x)) - y = float(self.convert_yunits(y)) + x = cbook._to_unmasked_float_array(axes.xaxis.convert_units(x)) + y = cbook._to_unmasked_float_array(axes.yaxis.convert_units(y)) return trans.transform((x, y)) elif s == 'offset points': if self.xycoords == 'offset points': # prevent recursion diff --git a/lib/matplotlib/tests/test_patches.py b/lib/matplotlib/tests/test_patches.py index edbafa074de5..9cb67616a96b 100644 --- a/lib/matplotlib/tests/test_patches.py +++ b/lib/matplotlib/tests/test_patches.py @@ -606,6 +606,28 @@ def test_connection_patch_fig(fig_test, fig_ref): fig_ref.add_artist(con) +@check_figures_equal(extensions=["png"]) +def test_connection_patch_pixel_points(fig_test, fig_ref): + xyA_pts = (.3, .2) + xyB_pts = (-30, -20) + + ax1, ax2 = fig_test.subplots(1, 2) + con = mpatches.ConnectionPatch(xyA=xyA_pts, coordsA="axes points", axesA=ax1, + xyB=xyB_pts, coordsB="figure points", + arrowstyle="->", shrinkB=5) + fig_test.add_artist(con) + + plt.rcParams["savefig.dpi"] = plt.rcParams["figure.dpi"] + + ax1, ax2 = fig_ref.subplots(1, 2) + xyA_pix = (xyA_pts[0]*(fig_ref.dpi/72), xyA_pts[1]*(fig_ref.dpi/72)) + xyB_pix = (xyB_pts[0]*(fig_ref.dpi/72), xyB_pts[1]*(fig_ref.dpi/72)) + con = mpatches.ConnectionPatch(xyA=xyA_pix, coordsA="axes pixels", axesA=ax1, + xyB=xyB_pix, coordsB="figure pixels", + arrowstyle="->", shrinkB=5) + fig_ref.add_artist(con) + + def test_datetime_rectangle(): # Check that creating a rectangle with timedeltas doesn't fail from datetime import datetime, timedelta diff --git a/lib/matplotlib/tests/test_units.py b/lib/matplotlib/tests/test_units.py index 42339f8c0c6f..cc71f685857e 100644 --- a/lib/matplotlib/tests/test_units.py +++ b/lib/matplotlib/tests/test_units.py @@ -4,6 +4,7 @@ import matplotlib.pyplot as plt from matplotlib.testing.decorators import check_figures_equal, image_comparison +import matplotlib.patches as mpatches import matplotlib.units as munits from matplotlib.category import StrCategoryConverter, UnitData from matplotlib.dates import DateConverter @@ -336,3 +337,17 @@ def test_plot_kernel(): # just a smoketest that fail kernel = Kernel([1, 2, 3, 4, 5]) plt.plot(kernel) + + +def test_connection_patch_units(pd): + # tests that this doesn't raise an error + fig, (ax1, ax2) = plt.subplots(nrows=2, figsize=(10, 5)) + x = pd.Timestamp('2017-01-01T12') + ax1.axvline(x) + y = "test test" + ax2.axhline(y) + arr = mpatches.ConnectionPatch((x, 0), (0, y), + coordsA='data', coordsB='data', + axesA=ax1, axesB=ax2) + fig.add_artist(arr) + fig.draw_without_rendering() From ddbd08e773f1aaa755ddc30c5676244d8fc848b5 Mon Sep 17 00:00:00 2001 From: Tim Hoffmann <2836374+timhoffm@users.noreply.github.com> Date: Thu, 5 Dec 2024 23:52:19 +0100 Subject: [PATCH 088/131] Backport PR #29236: ANI: Reduce Pillow frames to RGB when opaque --- lib/matplotlib/animation.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/lib/matplotlib/animation.py b/lib/matplotlib/animation.py index 47f2f0f9515b..2be61284073a 100644 --- a/lib/matplotlib/animation.py +++ b/lib/matplotlib/animation.py @@ -492,8 +492,15 @@ def grab_frame(self, **savefig_kwargs): buf = BytesIO() self.fig.savefig( buf, **{**savefig_kwargs, "format": "rgba", "dpi": self.dpi}) - self._frames.append(Image.frombuffer( - "RGBA", self.frame_size, buf.getbuffer(), "raw", "RGBA", 0, 1)) + im = Image.frombuffer( + "RGBA", self.frame_size, buf.getbuffer(), "raw", "RGBA", 0, 1) + if im.getextrema()[3][0] < 255: + # This frame has transparency, so we'll just add it as is. + self._frame.append(im) + else: + # Without transparency, we switch to RGB mode, which converts to P mode a + # little better if needed (specifically, this helps with GIF output.) + self._frames.append(im.convert("RGB")) def finish(self): self._frames[0].save( From c1a7e20f0b3d0b45b800783cbd336cd89a2b0bfc Mon Sep 17 00:00:00 2001 From: Scott Shambaugh <14363975+scottshambaugh@users.noreply.github.com> Date: Fri, 6 Dec 2024 11:02:11 -0700 Subject: [PATCH 089/131] Backport PR #29240: DOC: Add plt.show() to introductory pyplot example --- lib/matplotlib/pyplot.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/matplotlib/pyplot.py b/lib/matplotlib/pyplot.py index e864479f1b1b..ba7a5e32f5d0 100644 --- a/lib/matplotlib/pyplot.py +++ b/lib/matplotlib/pyplot.py @@ -15,6 +15,7 @@ x = np.arange(0, 5, 0.1) y = np.sin(x) plt.plot(x, y) + plt.show() The explicit object-oriented API is recommended for complex plots, though pyplot is still usually used to create the figure and often the Axes in the @@ -29,6 +30,7 @@ y = np.sin(x) fig, ax = plt.subplots() ax.plot(x, y) + plt.show() See :ref:`api_interfaces` for an explanation of the tradeoffs between the From 6c97a4cd8616cd10205d3d1224a9b8443f527928 Mon Sep 17 00:00:00 2001 From: Tim Hoffmann <2836374+timhoffm@users.noreply.github.com> Date: Sat, 7 Dec 2024 07:21:09 +0100 Subject: [PATCH 090/131] Backport PR #29243: Add quotes around [dev] in environment.yml --- environment.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/environment.yml b/environment.yml index 1c1711e95fb5..4a36f76031ea 100644 --- a/environment.yml +++ b/environment.yml @@ -2,7 +2,7 @@ # # conda env create -f environment.yml # conda activate mpl-dev -# pip install -e .[dev] +# pip install --verbose --no-build-isolation --editable ".[dev]" # --- name: mpl-dev From 6348165c649e8efb410582025534f73997661666 Mon Sep 17 00:00:00 2001 From: Victor Liu Date: Sat, 7 Dec 2024 15:39:07 -0500 Subject: [PATCH 091/131] modified test for _generate_normals --- lib/mpl_toolkits/mplot3d/tests/test_art3d.py | 30 ++++---------------- 1 file changed, 6 insertions(+), 24 deletions(-) diff --git a/lib/mpl_toolkits/mplot3d/tests/test_art3d.py b/lib/mpl_toolkits/mplot3d/tests/test_art3d.py index bb791f68343e..04e756ed9499 100644 --- a/lib/mpl_toolkits/mplot3d/tests/test_art3d.py +++ b/lib/mpl_toolkits/mplot3d/tests/test_art3d.py @@ -57,29 +57,11 @@ def test_zordered_error(): def test_generate_normals(): - - # Following code is an example taken from - # https://stackoverflow.com/questions/18897786/transparency-for-poly3dcollection-plot-in-matplotlib - # and modified to test _generate_normals function + # Smoke test for https://github.com/matplotlib/matplotlib/issues/29156 + vertices = ((0, 0, 0), (0, 5, 0), (5, 5, 0), (5, 0, 0)) + shape = Poly3DCollection([vertices], edgecolors='r', shade=True) fig = plt.figure() - ax = fig.add_subplot(111, projection='3d') - - x = [0, 2, 1, 1] - y = [0, 0, 1, 0] - z = [0, 0, 0, 1] - - # deliberately use nested tuple - vertices = ((0, 1, 2), (0, 1, 3), (0, 2, 3), (1, 2, 3)) - - tupleList = list(zip(x, y, z)) - - poly3d = [[tupleList[vertices[ix][iy]] for iy in range(len(vertices[0]))] - for ix in range(len(vertices))] - ax.scatter(x, y, z) - collection = Poly3DCollection(poly3d, alpha=0.2, edgecolors='r', shade=True) - face_color = [0.5, 0.5, 1] # alternative: matplotlib.colors.rgb2hex([0.5, 0.5, 1]) - collection.set_facecolor(face_color) - ax.add_collection3d(collection) - - plt.draw() + ax = fig.add_subplot(projection='3d') + ax.add_collection3d(shape) + plt.show() From 3982428df4fed6cb0a6c6ee433e6b8a0d2933e7c Mon Sep 17 00:00:00 2001 From: Victor Liu Date: Sat, 7 Dec 2024 16:04:59 -0500 Subject: [PATCH 092/131] changed plot.show to plot.draw --- lib/mpl_toolkits/mplot3d/tests/test_art3d.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/mpl_toolkits/mplot3d/tests/test_art3d.py b/lib/mpl_toolkits/mplot3d/tests/test_art3d.py index 04e756ed9499..4d33636a0b05 100644 --- a/lib/mpl_toolkits/mplot3d/tests/test_art3d.py +++ b/lib/mpl_toolkits/mplot3d/tests/test_art3d.py @@ -64,4 +64,4 @@ def test_generate_normals(): fig = plt.figure() ax = fig.add_subplot(projection='3d') ax.add_collection3d(shape) - plt.show() + plt.draw() From 4ca5d5e896d49245bc63f2e7aa606d322999b336 Mon Sep 17 00:00:00 2001 From: Kyra Cho Date: Sun, 8 Dec 2024 00:18:40 -0800 Subject: [PATCH 093/131] Backport PR #29249: [Bug Fix] Fix reverse mapping for _translate_tick_params --- lib/matplotlib/axis.py | 17 +++++++++++------ lib/matplotlib/tests/test_axis.py | 9 +++++++++ 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/lib/matplotlib/axis.py b/lib/matplotlib/axis.py index dc816eccc30a..56eeb0e4169b 100644 --- a/lib/matplotlib/axis.py +++ b/lib/matplotlib/axis.py @@ -1053,8 +1053,8 @@ def get_tick_params(self, which='major'): ) return self._translate_tick_params(self._minor_tick_kw, reverse=True) - @staticmethod - def _translate_tick_params(kw, reverse=False): + @classmethod + def _translate_tick_params(cls, kw, reverse=False): """ Translate the kwargs supported by `.Axis.set_tick_params` to kwargs supported by `.Tick._apply_params`. @@ -1096,10 +1096,15 @@ def _translate_tick_params(kw, reverse=False): 'labeltop': 'label2On', } if reverse: - kwtrans = { - oldkey: kw_.pop(newkey) - for oldkey, newkey in keymap.items() if newkey in kw_ - } + kwtrans = {} + is_x_axis = cls.axis_name == 'x' + y_axis_keys = ['left', 'right', 'labelleft', 'labelright'] + for oldkey, newkey in keymap.items(): + if newkey in kw_: + if is_x_axis and oldkey in y_axis_keys: + continue + else: + kwtrans[oldkey] = kw_.pop(newkey) else: kwtrans = { newkey: kw_.pop(oldkey) diff --git a/lib/matplotlib/tests/test_axis.py b/lib/matplotlib/tests/test_axis.py index 33af30662a33..c1b09006607d 100644 --- a/lib/matplotlib/tests/test_axis.py +++ b/lib/matplotlib/tests/test_axis.py @@ -29,3 +29,12 @@ def test_axis_not_in_layout(): # Positions should not be affected by overlapping 100 label assert ax1_left.get_position().bounds == ax2_left.get_position().bounds assert ax1_right.get_position().bounds == ax2_right.get_position().bounds + + +def test_translate_tick_params_reverse(): + fig, ax = plt.subplots() + kw = {'label1On': 'a', 'label2On': 'b', 'tick1On': 'c', 'tick2On': 'd'} + assert (ax.xaxis._translate_tick_params(kw, reverse=True) == + {'labelbottom': 'a', 'labeltop': 'b', 'bottom': 'c', 'top': 'd'}) + assert (ax.yaxis._translate_tick_params(kw, reverse=True) == + {'labelleft': 'a', 'labelright': 'b', 'left': 'c', 'right': 'd'}) From 18401627d6ec796fdf3d46b1746a9f0d60183799 Mon Sep 17 00:00:00 2001 From: Tim Hoffmann <2836374+timhoffm@users.noreply.github.com> Date: Mon, 9 Dec 2024 17:41:29 +0100 Subject: [PATCH 094/131] Backport PR #29251: Zizmor audit --- .github/workflows/cibuildwheel.yml | 15 +++++++------ .github/workflows/circleci.yml | 10 ++++++--- .github/workflows/clean_pr.yml | 3 ++- .github/workflows/codeql-analysis.yml | 8 ++++--- .github/workflows/conflictcheck.yml | 5 ++--- .github/workflows/cygwin.yml | 11 +++++----- .github/workflows/do_not_merge.yml | 1 - .github/workflows/good-first-issue.yml | 2 +- .github/workflows/labeler.yml | 2 +- .github/workflows/mypy-stubtest.yml | 11 ++++++---- .github/workflows/pr_welcome.yml | 8 +++---- .github/workflows/reviewdog.yml | 30 +++++++++++++++++--------- .github/workflows/stale-tidy.yml | 2 +- .github/workflows/stale.yml | 2 +- .github/workflows/tests.yml | 19 ++++++++-------- 15 files changed, 74 insertions(+), 55 deletions(-) diff --git a/.github/workflows/cibuildwheel.yml b/.github/workflows/cibuildwheel.yml index 136322878462..b8cd05367b6a 100644 --- a/.github/workflows/cibuildwheel.yml +++ b/.github/workflows/cibuildwheel.yml @@ -39,11 +39,12 @@ jobs: SDIST_NAME: ${{ steps.sdist.outputs.SDIST_NAME }} steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 with: fetch-depth: 0 + persist-credentials: false - - uses: actions/setup-python@v5 + - uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0 name: Install Python with: python-version: '3.10' @@ -69,7 +70,7 @@ jobs: run: twine check dist/* - name: Upload sdist result - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3 with: name: cibw-sdist path: dist/*.tar.gz @@ -132,12 +133,12 @@ jobs: steps: - name: Set up QEMU if: matrix.cibw_archs == 'aarch64' - uses: docker/setup-qemu-action@v3 + uses: docker/setup-qemu-action@49b3bc8e6bdd4a60e6116a5414239cba5943d3cf # v3.2.0 with: platforms: arm64 - name: Download sdist - uses: actions/download-artifact@v4 + uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8 with: name: cibw-sdist path: dist/ @@ -201,7 +202,7 @@ jobs: unset PIP_CONSTRAINT if: matrix.cibw_archs != 'aarch64' && matrix.os != 'windows-latest' - - uses: actions/upload-artifact@v4 + - uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3 with: name: cibw-wheels-${{ runner.os }}-${{ matrix.cibw_archs }} path: ./wheelhouse/*.whl @@ -219,7 +220,7 @@ jobs: contents: read steps: - name: Download packages - uses: actions/download-artifact@v4 + uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8 with: pattern: cibw-* path: dist diff --git a/.github/workflows/circleci.yml b/.github/workflows/circleci.yml index a64b312e8246..e0ed6adf4e65 100644 --- a/.github/workflows/circleci.yml +++ b/.github/workflows/circleci.yml @@ -28,16 +28,20 @@ jobs: runs-on: ubuntu-latest name: Post warnings/errors as review steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + with: + persist-credentials: false - name: Fetch result artifacts id: fetch-artifacts + env: + target_url: "${{ github.event.target_url }}" run: | - python .circleci/fetch_doc_logs.py "${{ github.event.target_url }}" + python .circleci/fetch_doc_logs.py "${target_url}" - name: Set up reviewdog if: "${{ steps.fetch-artifacts.outputs.count != 0 }}" - uses: reviewdog/action-setup@v1 + uses: reviewdog/action-setup@3f401fe1d58fe77e10d665ab713057375e39b887 # v1.3.0 with: reviewdog_version: latest diff --git a/.github/workflows/clean_pr.yml b/.github/workflows/clean_pr.yml index 77e49f7c1d9e..fc9021c920c0 100644 --- a/.github/workflows/clean_pr.yml +++ b/.github/workflows/clean_pr.yml @@ -10,9 +10,10 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 with: fetch-depth: '0' + persist-credentials: false - name: Check for added-and-deleted files run: | git fetch --quiet origin "$GITHUB_BASE_REF" diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 203b0eee9ca4..4bf3e680f7b0 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -26,10 +26,12 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v4 + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + with: + persist-credentials: false - name: Initialize CodeQL - uses: github/codeql-action/init@v3 + uses: github/codeql-action/init@aa578102511db1f4524ed59b8cc2bae4f6e88195 # v3.27.6 with: languages: ${{ matrix.language }} @@ -40,4 +42,4 @@ jobs: pip install --user -v . - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v3 + uses: github/codeql-action/analyze@aa578102511db1f4524ed59b8cc2bae4f6e88195 # v3.27.6 diff --git a/.github/workflows/conflictcheck.yml b/.github/workflows/conflictcheck.yml index 3110839e5150..b018101f325c 100644 --- a/.github/workflows/conflictcheck.yml +++ b/.github/workflows/conflictcheck.yml @@ -9,12 +9,11 @@ on: pull_request_target: types: [synchronize] -permissions: - pull-requests: write - jobs: main: runs-on: ubuntu-latest + permissions: + pull-requests: write steps: - name: Check if PRs have merge conflicts uses: eps1lon/actions-label-merge-conflict@1b1b1fcde06a9b3d089f3464c96417961dde1168 # v3.0.2 diff --git a/.github/workflows/cygwin.yml b/.github/workflows/cygwin.yml index 5dee68597d5c..bde902013412 100644 --- a/.github/workflows/cygwin.yml +++ b/.github/workflows/cygwin.yml @@ -79,11 +79,12 @@ jobs: - name: Fix line endings run: git config --global core.autocrlf input - - uses: actions/checkout@v4 + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 with: fetch-depth: 0 + persist-credentials: false - - uses: cygwin/cygwin-install-action@v4 + - uses: cygwin/cygwin-install-action@006ad0b0946ca6d0a3ea2d4437677fa767392401 # v4 with: packages: >- ccache gcc-g++ gdb git graphviz libcairo-devel libffi-devel @@ -139,21 +140,21 @@ jobs: # FreeType build fails with bash, succeeds with dash - name: Cache pip - uses: actions/cache@v4 + uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0 with: path: C:\cygwin\home\runneradmin\.cache\pip key: Cygwin-py3.${{ matrix.python-minor-version }}-pip-${{ hashFiles('requirements/*/*.txt') }} restore-keys: ${{ matrix.os }}-py3.${{ matrix.python-minor-version }}-pip- - name: Cache ccache - uses: actions/cache@v4 + uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0 with: path: C:\cygwin\home\runneradmin\.ccache key: Cygwin-py3.${{ matrix.python-minor-version }}-ccache-${{ hashFiles('src/*') }} restore-keys: Cygwin-py3.${{ matrix.python-minor-version }}-ccache- - name: Cache Matplotlib - uses: actions/cache@v4 + uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0 with: path: | C:\cygwin\home\runneradmin\.cache\matplotlib diff --git a/.github/workflows/do_not_merge.yml b/.github/workflows/do_not_merge.yml index dde5bfb5ec81..d8664df9ba9a 100644 --- a/.github/workflows/do_not_merge.yml +++ b/.github/workflows/do_not_merge.yml @@ -23,7 +23,6 @@ jobs: echo "This PR cannot be merged because it has one of the following labels: " echo "* status: needs comment/discussion" echo "* status: waiting for other PR" - echo "${{env.has_tag}}" exit 1 - name: Allow merging if: ${{'false' == env.has_tag}} diff --git a/.github/workflows/good-first-issue.yml b/.github/workflows/good-first-issue.yml index 8905511fc01d..cc15717e3351 100644 --- a/.github/workflows/good-first-issue.yml +++ b/.github/workflows/good-first-issue.yml @@ -12,7 +12,7 @@ jobs: issues: write steps: - name: Add comment - uses: peter-evans/create-or-update-comment@v4 + uses: peter-evans/create-or-update-comment@71345be0265236311c031f5c7866368bd1eff043 # v4.0.0 with: issue-number: ${{ github.event.issue.number }} body: | diff --git a/.github/workflows/labeler.yml b/.github/workflows/labeler.yml index dc7a0716bfe8..8e2002353164 100644 --- a/.github/workflows/labeler.yml +++ b/.github/workflows/labeler.yml @@ -10,6 +10,6 @@ jobs: pull-requests: write runs-on: ubuntu-latest steps: - - uses: actions/labeler@v5 + - uses: actions/labeler@8558fd74291d67161a8a78ce36a881fa63b766a9 # v5.0.0 with: sync-labels: true diff --git a/.github/workflows/mypy-stubtest.yml b/.github/workflows/mypy-stubtest.yml index 5b29a93b7533..57acc3616ae6 100644 --- a/.github/workflows/mypy-stubtest.yml +++ b/.github/workflows/mypy-stubtest.yml @@ -4,22 +4,25 @@ on: [pull_request] permissions: contents: read - checks: write jobs: mypy-stubtest: name: mypy-stubtest runs-on: ubuntu-latest + permissions: + checks: write steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + with: + persist-credentials: false - name: Set up Python 3 - uses: actions/setup-python@v5 + uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0 with: python-version: '3.10' - name: Set up reviewdog - uses: reviewdog/action-setup@v1 + uses: reviewdog/action-setup@3f401fe1d58fe77e10d665ab713057375e39b887 # v1.3.9 - name: Install tox run: python -m pip install tox diff --git a/.github/workflows/pr_welcome.yml b/.github/workflows/pr_welcome.yml index 533f676a0fab..3bb172ca70e7 100644 --- a/.github/workflows/pr_welcome.yml +++ b/.github/workflows/pr_welcome.yml @@ -3,15 +3,13 @@ name: PR Greetings on: [pull_request_target] -permissions: - pull-requests: write - jobs: greeting: runs-on: ubuntu-latest - + permissions: + pull-requests: write steps: - - uses: actions/first-interaction@v1 + - uses: actions/first-interaction@34f15e814fe48ac9312ccf29db4e74fa767cbab7 # v1.3.0 with: repo-token: ${{ secrets.GITHUB_TOKEN }} pr-message: >+ diff --git a/.github/workflows/reviewdog.yml b/.github/workflows/reviewdog.yml index 12b59d866e42..24980f7a075b 100644 --- a/.github/workflows/reviewdog.yml +++ b/.github/workflows/reviewdog.yml @@ -4,18 +4,20 @@ on: [pull_request] permissions: contents: read - checks: write - pull-requests: write jobs: flake8: name: flake8 runs-on: ubuntu-latest + permissions: + checks: write steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + with: + persist-credentials: false - name: Set up Python 3 - uses: actions/setup-python@v5 + uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0 with: python-version: '3.10' @@ -23,7 +25,7 @@ jobs: run: pip3 install -r requirements/testing/flake8.txt - name: Set up reviewdog - uses: reviewdog/action-setup@v1 + uses: reviewdog/action-setup@3f401fe1d58fe77e10d665ab713057375e39b887 # v1.3.9 - name: Run flake8 env: @@ -36,11 +38,15 @@ jobs: mypy: name: mypy runs-on: ubuntu-latest + permissions: + checks: write steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + with: + persist-credentials: false - name: Set up Python 3 - uses: actions/setup-python@v5 + uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0 with: python-version: '3.10' @@ -48,7 +54,7 @@ jobs: run: pip3 install -r requirements/testing/mypy.txt -r requirements/testing/all.txt - name: Set up reviewdog - uses: reviewdog/action-setup@v1 + uses: reviewdog/action-setup@3f401fe1d58fe77e10d665ab713057375e39b887 # v1.3.9 - name: Run mypy env: @@ -63,11 +69,15 @@ jobs: eslint: name: eslint runs-on: ubuntu-latest + permissions: + checks: write steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + with: + persist-credentials: false - name: eslint - uses: reviewdog/action-eslint@v1 + uses: reviewdog/action-eslint@9b5b0150e399e1f007ee3c27bc156549810a64e3 # v1.33.0 with: filter_mode: nofilter github_token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/stale-tidy.yml b/.github/workflows/stale-tidy.yml index 92a81ee856e4..ab16c9f1fa1c 100644 --- a/.github/workflows/stale-tidy.yml +++ b/.github/workflows/stale-tidy.yml @@ -9,7 +9,7 @@ jobs: if: github.repository == 'matplotlib/matplotlib' runs-on: ubuntu-latest steps: - - uses: actions/stale@v9 + - uses: actions/stale@28ca1036281a5e5922ead5184a1bbf96e5fc984e # v9.0.0 with: repo-token: ${{ secrets.GITHUB_TOKEN }} operations-per-run: 300 diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml index c606d4288bd2..4dc964a0ea73 100644 --- a/.github/workflows/stale.yml +++ b/.github/workflows/stale.yml @@ -9,7 +9,7 @@ jobs: if: github.repository == 'matplotlib/matplotlib' runs-on: ubuntu-latest steps: - - uses: actions/stale@v9 + - uses: actions/stale@28ca1036281a5e5922ead5184a1bbf96e5fc984e # v9.0.0 with: repo-token: ${{ secrets.GITHUB_TOKEN }} operations-per-run: 20 diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 5608cade2aa0..27aab4b392ee 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -111,12 +111,13 @@ jobs: pyside6-ver: '!=6.5.1' steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 with: fetch-depth: 0 + persist-credentials: false - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v5 + uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0 if: matrix.python-version != '3.13t' with: python-version: ${{ matrix.python-version }} @@ -202,7 +203,7 @@ jobs: esac - name: Cache pip - uses: actions/cache@v4 + uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0 if: startsWith(runner.os, 'Linux') with: path: ~/.cache/pip @@ -210,7 +211,7 @@ jobs: restore-keys: | ${{ matrix.os }}-py${{ matrix.python-version }}-pip- - name: Cache pip - uses: actions/cache@v4 + uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0 if: startsWith(runner.os, 'macOS') with: path: ~/Library/Caches/pip @@ -218,7 +219,7 @@ jobs: restore-keys: | ${{ matrix.os }}-py${{ matrix.python-version }}-pip- - name: Cache ccache - uses: actions/cache@v4 + uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0 with: path: | ~/.ccache @@ -226,7 +227,7 @@ jobs: restore-keys: | ${{ matrix.os }}-py${{ matrix.python-version }}-ccache- - name: Cache Matplotlib - uses: actions/cache@v4 + uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0 with: path: | ~/.cache/matplotlib @@ -407,12 +408,12 @@ jobs: fi - name: Upload code coverage if: ${{ !cancelled() && github.event_name != 'schedule' }} - uses: codecov/codecov-action@v5 + uses: codecov/codecov-action@7f8b4b4bde536c465e797be725718b88c5d95e0e # v5.1.1 with: name: "${{ matrix.python-version }} ${{ matrix.os }} ${{ matrix.name-suffix }}" token: ${{ secrets.CODECOV_TOKEN }} - - uses: actions/upload-artifact@v4 + - uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3 if: failure() with: name: "${{ matrix.python-version }} ${{ matrix.os }} ${{ matrix.name-suffix }} result images" @@ -429,7 +430,7 @@ jobs: steps: - name: Create issue on failure - uses: imjohnbo/issue-bot@v3 + uses: imjohnbo/issue-bot@572eed14422c4d6ca37e870f97e7da209422f5bd # v3.4.4 with: title: "[TST] Upcoming dependency test failures" body: | From 0fbc882d85a8789af1ebac9e8969a938311b2463 Mon Sep 17 00:00:00 2001 From: Thomas A Caswell Date: Mon, 9 Dec 2024 14:17:36 -0500 Subject: [PATCH 095/131] Backport PR #29267: Exclude pylab from mypy checks --- ci/mypy-stubtest-allowlist.txt | 2 +- pyproject.toml | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/ci/mypy-stubtest-allowlist.txt b/ci/mypy-stubtest-allowlist.txt index 1d08a690d8f2..46ec06e0a9f1 100644 --- a/ci/mypy-stubtest-allowlist.txt +++ b/ci/mypy-stubtest-allowlist.txt @@ -1,7 +1,7 @@ # Non-typed (and private) modules/functions matplotlib\.backends\..* matplotlib\.tests(\..*)? -matplotlib\.pylab\..* +matplotlib\.pylab(\..*)? matplotlib\._.* matplotlib\.rcsetup\._listify_validator matplotlib\.rcsetup\._validate_linestyle diff --git a/pyproject.toml b/pyproject.toml index 48a174731440..5451e972de8d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -222,7 +222,7 @@ enable_incomplete_feature = [ ] exclude = [ #stubtest - ".*/matplotlib/(sphinxext|backends|testing/jpl_units)", + ".*/matplotlib/(sphinxext|backends|pylab|testing/jpl_units)", #mypy precommit "galleries/", "doc/", @@ -234,7 +234,9 @@ exclude = [ "lib/matplotlib/tests/", # tinypages is used for testing the sphinx ext, # stubtest will import and run, opening a figure if not excluded - ".*/tinypages" + ".*/tinypages", + # pylab's numpy wildcard imports cause re-def failures since numpy 2.2 + "lib/matplotlib/pylab.py", ] files = [ "lib/matplotlib", From c1a2834df2e055a443db62c5fc2c4780bd0edd2b Mon Sep 17 00:00:00 2001 From: Thomas A Caswell Date: Tue, 10 Dec 2024 11:13:13 -0500 Subject: [PATCH 096/131] Backport PR #29247: Fix building freetype 2.6.1 on macOS clang 18 --- .../freetype-2.6.1-meson/src/gzip/zconf.h | 284 ++++++++++++++++++ 1 file changed, 284 insertions(+) create mode 100644 subprojects/packagefiles/freetype-2.6.1-meson/src/gzip/zconf.h diff --git a/subprojects/packagefiles/freetype-2.6.1-meson/src/gzip/zconf.h b/subprojects/packagefiles/freetype-2.6.1-meson/src/gzip/zconf.h new file mode 100644 index 000000000000..d88a82a2eec8 --- /dev/null +++ b/subprojects/packagefiles/freetype-2.6.1-meson/src/gzip/zconf.h @@ -0,0 +1,284 @@ +/* zconf.h -- configuration of the zlib compression library + * Copyright (C) 1995-2002 Jean-loup Gailly. + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +/* @(#) $Id$ */ + +#ifndef _ZCONF_H +#define _ZCONF_H + +/* + * If you *really* need a unique prefix for all types and library functions, + * compile with -DZ_PREFIX. The "standard" zlib should be compiled without it. + */ +#ifdef Z_PREFIX +# define deflateInit_ z_deflateInit_ +# define deflate z_deflate +# define deflateEnd z_deflateEnd +# define inflateInit_ z_inflateInit_ +# define inflate z_inflate +# define inflateEnd z_inflateEnd +# define deflateInit2_ z_deflateInit2_ +# define deflateSetDictionary z_deflateSetDictionary +# define deflateCopy z_deflateCopy +# define deflateReset z_deflateReset +# define deflateParams z_deflateParams +# define inflateInit2_ z_inflateInit2_ +# define inflateSetDictionary z_inflateSetDictionary +# define inflateSync z_inflateSync +# define inflateSyncPoint z_inflateSyncPoint +# define inflateReset z_inflateReset +# define compress z_compress +# define compress2 z_compress2 +# define uncompress z_uncompress +# define adler32 z_adler32 +# define crc32 z_crc32 +# define get_crc_table z_get_crc_table + +# define Byte z_Byte +# define uInt z_uInt +# define uLong z_uLong +# define Bytef z_Bytef +# define charf z_charf +# define intf z_intf +# define uIntf z_uIntf +# define uLongf z_uLongf +# define voidpf z_voidpf +# define voidp z_voidp +#endif + +#if (defined(_WIN32) || defined(__WIN32__)) && !defined(WIN32) +# define WIN32 +#endif +#if defined(__GNUC__) || defined(WIN32) || defined(__386__) || defined(i386) +# ifndef __32BIT__ +# define __32BIT__ +# endif +#endif +#if defined(__MSDOS__) && !defined(MSDOS) +# define MSDOS +#endif + +/* WinCE doesn't have errno.h */ +#ifdef _WIN32_WCE +# define NO_ERRNO_H +#endif + + +/* + * Compile with -DMAXSEG_64K if the alloc function cannot allocate more + * than 64k bytes at a time (needed on systems with 16-bit int). + */ +#if defined(MSDOS) && !defined(__32BIT__) +# define MAXSEG_64K +#endif +#ifdef MSDOS +# define UNALIGNED_OK +#endif + +#if (defined(MSDOS) || defined(_WINDOWS) || defined(WIN32)) && !defined(STDC) +# define STDC +#endif +#if defined(__STDC__) || defined(__cplusplus) || defined(__OS2__) +# ifndef STDC +# define STDC +# endif +#endif + +#ifndef STDC +# ifndef const /* cannot use !defined(STDC) && !defined(const) on Mac */ +# define const +# endif +#endif + +/* Some Mac compilers merge all .h files incorrectly: */ +#if defined(__MWERKS__) || defined(applec) ||defined(THINK_C) ||defined(__SC__) +# define NO_DUMMY_DECL +#endif + +/* Old Borland C and LCC incorrectly complains about missing returns: */ +#if defined(__BORLANDC__) && (__BORLANDC__ < 0x500) +# define NEED_DUMMY_RETURN +#endif + +#if defined(__LCC__) +# define NEED_DUMMY_RETURN +#endif + +/* Maximum value for memLevel in deflateInit2 */ +#ifndef MAX_MEM_LEVEL +# ifdef MAXSEG_64K +# define MAX_MEM_LEVEL 8 +# else +# define MAX_MEM_LEVEL 9 +# endif +#endif + +/* Maximum value for windowBits in deflateInit2 and inflateInit2. + * WARNING: reducing MAX_WBITS makes minigzip unable to extract .gz files + * created by gzip. (Files created by minigzip can still be extracted by + * gzip.) + */ +#ifndef MAX_WBITS +# define MAX_WBITS 15 /* 32K LZ77 window */ +#endif + +/* The memory requirements for deflate are (in bytes): + (1 << (windowBits+2)) + (1 << (memLevel+9)) + that is: 128K for windowBits=15 + 128K for memLevel = 8 (default values) + plus a few kilobytes for small objects. For example, if you want to reduce + the default memory requirements from 256K to 128K, compile with + make CFLAGS="-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7" + Of course this will generally degrade compression (there's no free lunch). + + The memory requirements for inflate are (in bytes) 1 << windowBits + that is, 32K for windowBits=15 (default value) plus a few kilobytes + for small objects. +*/ + + /* Type declarations */ + +#ifndef OF /* function prototypes */ +# ifdef STDC +# define OF(args) args +# else +# define OF(args) () +# endif +#endif + +/* The following definitions for FAR are needed only for MSDOS mixed + * model programming (small or medium model with some far allocations). + * This was tested only with MSC; for other MSDOS compilers you may have + * to define NO_MEMCPY in zutil.h. If you don't need the mixed model, + * just define FAR to be empty. + */ +#if (defined(M_I86SM) || defined(M_I86MM)) && !defined(__32BIT__) + /* MSC small or medium model */ +# define SMALL_MEDIUM +# ifdef _MSC_VER +# define FAR _far +# else +# define FAR far +# endif +#endif +#if defined(__BORLANDC__) && (defined(__SMALL__) || defined(__MEDIUM__)) +# ifndef __32BIT__ +# define SMALL_MEDIUM +# define FAR _far +# endif +#endif + +/* Compile with -DZLIB_DLL for Windows DLL support */ +#if defined(ZLIB_DLL) +# if defined(_WINDOWS) || defined(WINDOWS) +# ifdef FAR +# undef FAR +# endif +# include +# define ZEXPORT(x) x WINAPI +# ifdef WIN32 +# define ZEXPORTVA(x) x WINAPIV +# else +# define ZEXPORTVA(x) x FAR _cdecl _export +# endif +# endif +# if defined (__BORLANDC__) +# if (__BORLANDC__ >= 0x0500) && defined (WIN32) +# include +# define ZEXPORT(x) x __declspec(dllexport) WINAPI +# define ZEXPORTRVA(x) x __declspec(dllexport) WINAPIV +# else +# if defined (_Windows) && defined (__DLL__) +# define ZEXPORT(x) x _export +# define ZEXPORTVA(x) x _export +# endif +# endif +# endif +#endif + + +#ifndef ZEXPORT +# define ZEXPORT(x) static x +#endif +#ifndef ZEXPORTVA +# define ZEXPORTVA(x) static x +#endif +#ifndef ZEXTERN +# define ZEXTERN(x) static x +#endif +#ifndef ZEXTERNDEF +# define ZEXTERNDEF(x) static x +#endif + +#ifndef FAR +# define FAR +#endif + +#if !defined(__MACTYPES__) +typedef unsigned char Byte; /* 8 bits */ +#endif +typedef unsigned int uInt; /* 16 bits or more */ +typedef unsigned long uLong; /* 32 bits or more */ + +#ifdef SMALL_MEDIUM + /* Borland C/C++ and some old MSC versions ignore FAR inside typedef */ +# define Bytef Byte FAR +#else + typedef Byte FAR Bytef; +#endif +typedef char FAR charf; +typedef int FAR intf; +typedef uInt FAR uIntf; +typedef uLong FAR uLongf; + +#ifdef STDC + typedef void FAR *voidpf; + typedef void *voidp; +#else + typedef Byte FAR *voidpf; + typedef Byte *voidp; +#endif + +#ifdef HAVE_UNISTD_H +# include /* for off_t */ +# include /* for SEEK_* and off_t */ +# define z_off_t off_t +#endif +#ifndef SEEK_SET +# define SEEK_SET 0 /* Seek from beginning of file. */ +# define SEEK_CUR 1 /* Seek from current position. */ +# define SEEK_END 2 /* Set file pointer to EOF plus "offset" */ +#endif +#ifndef z_off_t +# define z_off_t long +#endif + +/* MVS linker does not support external names larger than 8 bytes */ +#if defined(__MVS__) +# pragma map(deflateInit_,"DEIN") +# pragma map(deflateInit2_,"DEIN2") +# pragma map(deflateEnd,"DEEND") +# pragma map(inflateInit_,"ININ") +# pragma map(inflateInit2_,"ININ2") +# pragma map(inflateEnd,"INEND") +# pragma map(inflateSync,"INSY") +# pragma map(inflateSetDictionary,"INSEDI") +# pragma map(inflate_blocks,"INBL") +# pragma map(inflate_blocks_new,"INBLNE") +# pragma map(inflate_blocks_free,"INBLFR") +# pragma map(inflate_blocks_reset,"INBLRE") +# pragma map(inflate_codes_free,"INCOFR") +# pragma map(inflate_codes,"INCO") +# pragma map(inflate_fast,"INFA") +# pragma map(inflate_flush,"INFLU") +# pragma map(inflate_mask,"INMA") +# pragma map(inflate_set_dictionary,"INSEDI2") +# pragma map(inflate_copyright,"INCOPY") +# pragma map(inflate_trees_bits,"INTRBI") +# pragma map(inflate_trees_dynamic,"INTRDY") +# pragma map(inflate_trees_fixed,"INTRFI") +# pragma map(inflate_trees_free,"INTRFR") +#endif + +#endif /* _ZCONF_H */ From abd01e7529ea23a3062da249b100b0d823142b44 Mon Sep 17 00:00:00 2001 From: Tim Hoffmann <2836374+timhoffm@users.noreply.github.com> Date: Tue, 10 Dec 2024 22:57:24 +0100 Subject: [PATCH 097/131] Backport PR #29265: DOC: Slightly improve the LineCollection docstring --- lib/matplotlib/collections.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/lib/matplotlib/collections.py b/lib/matplotlib/collections.py index a78f1838357e..f18d5a4c3a8c 100644 --- a/lib/matplotlib/collections.py +++ b/lib/matplotlib/collections.py @@ -1612,14 +1612,13 @@ def __init__(self, segments, # Can be None. """ Parameters ---------- - segments : list of array-like - A sequence (*line0*, *line1*, *line2*) of lines, where each line is a list - of points:: + segments : list of (N, 2) array-like + A sequence ``[line0, line1, ...]`` where each line is a (N, 2)-shape + array-like containing points:: - lineN = [(x0, y0), (x1, y1), ... (xm, ym)] + line0 = [(x0, y0), (x1, y1), ...] - or the equivalent Mx2 numpy array with two columns. Each line - can have a different number of segments. + Each line can contain a different number of points. linewidths : float or list of float, default: :rc:`lines.linewidth` The width of each line in points. colors : :mpltype:`color` or list of color, default: :rc:`lines.color` From 15c50efaada9ec9645bc92e88a65f814966f24d1 Mon Sep 17 00:00:00 2001 From: Tim Hoffmann <2836374+timhoffm@users.noreply.github.com> Date: Wed, 11 Dec 2024 14:53:23 +0100 Subject: [PATCH 098/131] Backport PR #29272: DOC: Add section on translating between Axes and pyplot interface --- .../users_explain/figure/api_interfaces.rst | 45 +++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/galleries/users_explain/figure/api_interfaces.rst b/galleries/users_explain/figure/api_interfaces.rst index 177e516cdaa0..981359dbee0b 100644 --- a/galleries/users_explain/figure/api_interfaces.rst +++ b/galleries/users_explain/figure/api_interfaces.rst @@ -121,6 +121,51 @@ In the explicit interface, this would be: axs[0].plot([1, 2, 3], [0, 0.5, 0.2]) axs[1].plot([3, 2, 1], [0, 0.5, 0.2]) +Translating between the Axes interface and the pyplot interface +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +You may find either interface in existing code, and unfortunately sometimes even +mixtures. This section describes the patterns for specific operations in both +interfaces and how to translate from one to the other. + +- Creating figures is the same for both interfaces: Use the respective `.pyplot` + functions ``plt.figure()``, ``plt.subplots()``, ``plt.subplot_mosaic()``. + For the Axes interface, you typically store the created Figure (and possibly + Axes) in variables for later use. When using the pyplot interface, these + values are typically not stored. Example: + + - Axes: ``fig, ax = plt.subplots()`` + - pyplot: ``plt.subplots()`` + +- "Plotting" functions, i.e. functions that add data, are named the same and + have identical parameters on the Axes and in pyplot. Example: + + - Axes: ``ax.plot(x, y)`` + - pyplot: ``plt.plot(x, y)`` + +- Functions that retrieve properties are named like the property in pyplot + and are prefixed with ``get_`` on the Axes. Example: + + - Axes: ``label = ax.get_xlabel()`` + - pyplot: ``label = plt.xlabel()`` + +- Functions that set properties like the property in pyplot and are prefixed with + ``set_`` on the Axes. Example: + + - Axes: ``ax.set_xlabel("time")`` + - pyplot: ``plt.xlabel("time")`` + +Here is a short summary of the examples again as a side-by-side comparison: + +================== ============================ ======================== +Operation Axes interface pyplot interface +================== ============================ ======================== +Creating figures ``fig, ax = plt.subplots()`` ``plt.subplots()`` +Plotting data ``ax.plot(x, y)`` ``plt.plot(x, y)`` +Getting properties ``label = ax.get_xlabel()`` ``label = plt.xlabel()`` +Setting properties ``ax.set_xlabel("time")`` ``plt.xlabel("time")`` +================== ============================ ======================== + + Why be explicit? ^^^^^^^^^^^^^^^^ From dd96a0850502362478ab6066a201a98659fd446b Mon Sep 17 00:00:00 2001 From: Scott Shambaugh <14363975+scottshambaugh@users.noreply.github.com> Date: Wed, 11 Dec 2024 13:14:40 -0700 Subject: [PATCH 099/131] Backport PR #29274: Bump the actions group across 1 directory with 2 updates --- .github/workflows/cibuildwheel.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/cibuildwheel.yml b/.github/workflows/cibuildwheel.yml index b8cd05367b6a..b1e5204ab12a 100644 --- a/.github/workflows/cibuildwheel.yml +++ b/.github/workflows/cibuildwheel.yml @@ -230,9 +230,9 @@ jobs: run: ls dist - name: Generate artifact attestation for sdist and wheel - uses: actions/attest-build-provenance@ef244123eb79f2f7a7e75d99086184180e6d0018 # v1.4.4 + uses: actions/attest-build-provenance@7668571508540a607bdfd90a87a560489fe372eb # v2.1.0 with: subject-path: dist/matplotlib-* - name: Publish package distributions to PyPI - uses: pypa/gh-action-pypi-publish@15c56dba361d8335944d31a2ecd17d700fc7bcbc # v1.12.2 + uses: pypa/gh-action-pypi-publish@67339c736fd9354cd4f8cb0b744f2b82a74b5c70 # v1.12.3 From 9f6370c3f98a714bce92550e7dc2ceff3d57a084 Mon Sep 17 00:00:00 2001 From: Scott Shambaugh <14363975+scottshambaugh@users.noreply.github.com> Date: Wed, 11 Dec 2024 17:11:30 -0700 Subject: [PATCH 100/131] Backport PR #29285: Retarget PR#29175 to main --- lib/mpl_toolkits/mplot3d/art3d.py | 1 + lib/mpl_toolkits/mplot3d/tests/test_art3d.py | 17 ++++++++++++++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/lib/mpl_toolkits/mplot3d/art3d.py b/lib/mpl_toolkits/mplot3d/art3d.py index 0467d2e96e5e..deb0ca34302c 100644 --- a/lib/mpl_toolkits/mplot3d/art3d.py +++ b/lib/mpl_toolkits/mplot3d/art3d.py @@ -1382,6 +1382,7 @@ def _generate_normals(polygons): v2 = np.empty((len(polygons), 3)) for poly_i, ps in enumerate(polygons): n = len(ps) + ps = np.asarray(ps) i1, i2, i3 = 0, n//3, 2*n//3 v1[poly_i, :] = ps[i1, :] - ps[i2, :] v2[poly_i, :] = ps[i2, :] - ps[i3, :] diff --git a/lib/mpl_toolkits/mplot3d/tests/test_art3d.py b/lib/mpl_toolkits/mplot3d/tests/test_art3d.py index f4f7067b76bb..174c12608ae9 100644 --- a/lib/mpl_toolkits/mplot3d/tests/test_art3d.py +++ b/lib/mpl_toolkits/mplot3d/tests/test_art3d.py @@ -3,7 +3,11 @@ import matplotlib.pyplot as plt from matplotlib.backend_bases import MouseEvent -from mpl_toolkits.mplot3d.art3d import Line3DCollection, _all_points_on_plane +from mpl_toolkits.mplot3d.art3d import ( + Line3DCollection, + Poly3DCollection, + _all_points_on_plane, +) def test_scatter_3d_projection_conservation(): @@ -85,3 +89,14 @@ def test_all_points_on_plane(): # All points lie on a plane points = np.array([[0, 0, 0], [0, 1, 0], [1, 0, 0], [1, 1, 0], [1, 2, 0]]) assert _all_points_on_plane(*points.T) + + +def test_generate_normals(): + # Smoke test for https://github.com/matplotlib/matplotlib/issues/29156 + vertices = ((0, 0, 0), (0, 5, 0), (5, 5, 0), (5, 0, 0)) + shape = Poly3DCollection([vertices], edgecolors='r', shade=True) + + fig = plt.figure() + ax = fig.add_subplot(projection='3d') + ax.add_collection3d(shape) + plt.draw() From b575af123dea5cfe5aabd60d13fecb11d3838c3d Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Wed, 11 Dec 2024 19:54:25 -0500 Subject: [PATCH 101/131] Backport PR #29260: DOC: Better explanation of rcParams "patch.edgecolor" and "patch.force_edgecolor" --- lib/matplotlib/mpl-data/matplotlibrc | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/matplotlib/mpl-data/matplotlibrc b/lib/matplotlib/mpl-data/matplotlibrc index 092b7a25a7d7..df4f4afadf96 100644 --- a/lib/matplotlib/mpl-data/matplotlibrc +++ b/lib/matplotlib/mpl-data/matplotlibrc @@ -148,8 +148,14 @@ ## for more information on patch properties. #patch.linewidth: 1.0 # edge width in points. #patch.facecolor: C0 -#patch.edgecolor: black # if forced, or patch is not filled -#patch.force_edgecolor: False # True to always use edgecolor +#patch.edgecolor: black # By default, Patches and Collections do not draw edges. + # This value is only used if facecolor is "none" + # (an Artist without facecolor and edgecolor would be + # invisible) or if patch.force_edgecolor is True. +#patch.force_edgecolor: False # By default, Patches and Collections do not draw edges. + # Set this to True to draw edges with patch.edgedcolor + # as the default edgecolor. + # This is mainly relevant for styles. #patch.antialiased: True # render patches in antialiased (no jaggies) From f90040392a79d89e7a619e407badfdf1be0016c1 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Wed, 11 Dec 2024 19:59:25 -0500 Subject: [PATCH 102/131] Backport PR #29254: DOC: Add note to align_labels() --- lib/matplotlib/figure.py | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/lib/matplotlib/figure.py b/lib/matplotlib/figure.py index e5cf88131178..3d6f9a7f4c16 100644 --- a/lib/matplotlib/figure.py +++ b/lib/matplotlib/figure.py @@ -1382,8 +1382,8 @@ def align_xlabels(self, axs=None): Notes ----- - This assumes that ``axs`` are from the same `.GridSpec`, so that - their `.SubplotSpec` positions correspond to figure positions. + This assumes that all Axes in ``axs`` are from the same `.GridSpec`, + so that their `.SubplotSpec` positions correspond to figure positions. Examples -------- @@ -1444,8 +1444,8 @@ def align_ylabels(self, axs=None): Notes ----- - This assumes that ``axs`` are from the same `.GridSpec`, so that - their `.SubplotSpec` positions correspond to figure positions. + This assumes that all Axes in ``axs`` are from the same `.GridSpec`, + so that their `.SubplotSpec` positions correspond to figure positions. Examples -------- @@ -1500,8 +1500,8 @@ def align_titles(self, axs=None): Notes ----- - This assumes that ``axs`` are from the same `.GridSpec`, so that - their `.SubplotSpec` positions correspond to figure positions. + This assumes that all Axes in ``axs`` are from the same `.GridSpec`, + so that their `.SubplotSpec` positions correspond to figure positions. Examples -------- @@ -1544,6 +1544,11 @@ def align_labels(self, axs=None): matplotlib.figure.Figure.align_xlabels matplotlib.figure.Figure.align_ylabels matplotlib.figure.Figure.align_titles + + Notes + ----- + This assumes that all Axes in ``axs`` are from the same `.GridSpec`, + so that their `.SubplotSpec` positions correspond to figure positions. """ self.align_xlabels(axs=axs) self.align_ylabels(axs=axs) From 8f303f2f473b103b52f52708da228b8bca0c5b9f Mon Sep 17 00:00:00 2001 From: Jody Klymak Date: Thu, 12 Dec 2024 16:35:55 -0800 Subject: [PATCH 103/131] Backport PR #29295: BLD: Pin meson-python to <0.17.0 --- pyproject.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 5451e972de8d..832d76308e0b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -46,7 +46,7 @@ requires-python = ">=3.10" [project.optional-dependencies] # Should be a copy of the build dependencies below. dev = [ - "meson-python>=0.13.1", + "meson-python>=0.13.1,<0.17.0", "pybind11>=2.13.2,!=2.13.3", "setuptools_scm>=7", # Not required by us but setuptools_scm without a version, cso _if_ @@ -70,7 +70,7 @@ dev = [ build-backend = "mesonpy" # Also keep in sync with optional dependencies above. requires = [ - "meson-python>=0.13.1", + "meson-python>=0.13.1,<0.17.0", "pybind11>=2.13.2,!=2.13.3", "setuptools_scm>=7", ] From 9d3cc1ec1c68943932059a15ff199bdd6d458fc0 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Thu, 12 Dec 2024 19:46:02 -0500 Subject: [PATCH 104/131] Backport PR #29295: BLD: Pin meson-python to <0.17.0 --- pyproject.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index c0237c7df5c5..aa6aa2350627 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -48,7 +48,7 @@ requires-python = ">=3.9" [project.optional-dependencies] # Should be a copy of the build dependencies below. dev = [ - "meson-python>=0.13.1", + "meson-python>=0.13.1,<0.17.0", "numpy>=1.25", "pybind11>=2.6,!=2.13.3", "setuptools_scm>=7", @@ -73,7 +73,7 @@ dev = [ build-backend = "mesonpy" # Also keep in sync with optional dependencies above. requires = [ - "meson-python>=0.13.1", + "meson-python>=0.13.1,<0.17.0", "pybind11>=2.6,!=2.13.3", "setuptools_scm>=7", From 69a98115f8bdaf0f3f615b062d3a380f01f017df Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Thu, 12 Dec 2024 23:29:02 -0500 Subject: [PATCH 105/131] REL: 3.9.4 This is the fourth bugfix release of the 3.9.x series. This release contains two bug-fixes: - Fix toolbar icons in GTK backend - Fix `Poly3DCollection` initialization with list of lists From f2b37c86a27e3b85855c05dfad977f1c8a470689 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Thu, 12 Dec 2024 23:33:50 -0500 Subject: [PATCH 106/131] BLD: bump branch away from tag So the tarballs from GitHub are stable. From 9d17a2bd1013d1f4446c321f3d866206d7972b31 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Fri, 13 Dec 2024 01:06:46 -0500 Subject: [PATCH 107/131] DOC: Add Zenodo DOI for 3.9.4 --- doc/_static/zenodo_cache/14436121.svg | 35 +++++++++++++++++++++++++++ doc/project/citing.rst | 3 +++ tools/cache_zenodo_svg.py | 1 + 3 files changed, 39 insertions(+) create mode 100644 doc/_static/zenodo_cache/14436121.svg diff --git a/doc/_static/zenodo_cache/14436121.svg b/doc/_static/zenodo_cache/14436121.svg new file mode 100644 index 000000000000..1e4a7cd5b7a4 --- /dev/null +++ b/doc/_static/zenodo_cache/14436121.svg @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + + + DOI + + + DOI + + + 10.5281/zenodo.14436121 + + + 10.5281/zenodo.14436121 + + + \ No newline at end of file diff --git a/doc/project/citing.rst b/doc/project/citing.rst index 544c899da4d2..be58473a26e4 100644 --- a/doc/project/citing.rst +++ b/doc/project/citing.rst @@ -32,6 +32,9 @@ By version .. START OF AUTOGENERATED +v3.9.4 + .. image:: ../_static/zenodo_cache/14436121.svg + :target: https://doi.org/10.5281/zenodo.14436121 v3.9.3 .. image:: ../_static/zenodo_cache/14249941.svg :target: https://doi.org/10.5281/zenodo.14249941 diff --git a/tools/cache_zenodo_svg.py b/tools/cache_zenodo_svg.py index e1a5d3bcec48..6e31c2a70011 100644 --- a/tools/cache_zenodo_svg.py +++ b/tools/cache_zenodo_svg.py @@ -63,6 +63,7 @@ def _get_xdg_cache_dir(): if __name__ == "__main__": data = { + "v3.9.4": "14436121", "v3.9.3": "14249941", "v3.9.2": "13308876", "v3.9.1": "12652732", From 73873c072a610a16703980d803be11e144e29e24 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Fri, 13 Dec 2024 01:11:55 -0500 Subject: [PATCH 108/131] DOC: Create release notes for 3.9.4 --- doc/users/github_stats.rst | 106 +++-------------- .../prev_whats_new/github_stats_3.9.3.rst | 108 ++++++++++++++++++ doc/users/release_notes.rst | 1 + 3 files changed, 123 insertions(+), 92 deletions(-) create mode 100644 doc/users/prev_whats_new/github_stats_3.9.3.rst diff --git a/doc/users/github_stats.rst b/doc/users/github_stats.rst index bec073081a68..a861867249cc 100644 --- a/doc/users/github_stats.rst +++ b/doc/users/github_stats.rst @@ -1,111 +1,33 @@ .. _github-stats: -GitHub statistics for 3.9.3 (Nov 30, 2024) +GitHub statistics for 3.9.4 (Dec 13, 2024) ========================================== -GitHub statistics for 2024/08/12 (tag: v3.9.2) - 2024/11/30 +GitHub statistics for 2024/11/30 (tag: v3.9.3) - 2024/12/13 These lists are automatically generated, and may be incomplete or contain duplicates. -We closed 6 issues and merged 62 pull requests. -The full list can be seen `on GitHub `__ +We closed 2 issues and merged 3 pull requests. +The full list can be seen `on GitHub `__ -The following 18 authors contributed 90 commits. +The following 3 authors contributed 15 commits. -* Andresporcruz -* Antony Lee -* Charlie LeWarne -* dependabot[bot] * Elliott Sales de Andrade -* Gavin S -* Greg Lucas -* hannah -* Kyle Sunden -* Kyra Cho -* kyracho -* Lumberbot (aka Jack) -* Michael Hinton -* Oscar Gustafsson -* Ruth Comer -* Thomas A Caswell -* Tim Hoffmann -* vittoboa +* Scott Shambaugh +* Victor Liu GitHub issues and pull requests: -Pull Requests (62): +Pull Requests (3): -* :ghpull:`29195`: Backport PR #29191 on branch v3.9.x (ci: Simplify 3.13t test setup) -* :ghpull:`29191`: ci: Simplify 3.13t test setup -* :ghpull:`29176`: Backport PR #29148 on branch v3.9.x (Don't fail on equal-but-differently-named cmaps in qt figureoptions.) -* :ghpull:`29148`: Don't fail on equal-but-differently-named cmaps in qt figureoptions. -* :ghpull:`29165`: Backport PR #29153 on branch v3.9.x (Bump codecov/codecov-action from 4 to 5 in the actions group) -* :ghpull:`29153`: Bump codecov/codecov-action from 4 to 5 in the actions group -* :ghpull:`29149`: Backport CI config updates to v3.9.x -* :ghpull:`29121`: Backport PR #29120 on branch v3.9.x (DOC: Switch nested pie example from cmaps to color_sequences) -* :ghpull:`29071`: Bump pypa/gh-action-pypi-publish from 1.10.3 to 1.11.0 in the actions group -* :ghpull:`29046`: Backport PR #28981 on branch v3.9.x (FIX: macos: Use standard NSApp run loop in our input hook) -* :ghpull:`28981`: FIX: macos: Use standard NSApp run loop in our input hook -* :ghpull:`29041`: Backport PR #29035 on branch v3.9.x (FIX: Don't set_wmclass on GTK3) -* :ghpull:`29035`: FIX: Don't set_wmclass on GTK3 -* :ghpull:`29037`: Backport PR #29036 on branch v3.9.x (Don't pass redundant inline=True to example clabel() calls.) -* :ghpull:`29032`: Backport PR #27569 on branch v3.9.x (DOC: initial tags for statistics section of gallery) -* :ghpull:`29034`: Backport PR #29031 on branch v3.9.x (DOC: Fix copy-paste typo in ColorSequenceRegistry) -* :ghpull:`29031`: DOC: Fix copy-paste typo in ColorSequenceRegistry -* :ghpull:`29015`: Backport PR #29014 on branch v3.9.x (FIX: fake out setuptools scm in tox on ci) -* :ghpull:`29014`: FIX: fake out setuptools scm in tox on ci -* :ghpull:`29010`: Backport PR #29005 on branch v3.9.x (DOC: Update meson-python intersphinx link) -* :ghpull:`29006`: Backport PR #28993 on branch v3.9.x (FIX: contourf hatches use multiple edgecolors) -* :ghpull:`28993`: FIX: contourf hatches use multiple edgecolors -* :ghpull:`28988`: Backport PR #28987 on branch v3.9.x (Fix: Do not use numeric tolerances for axline special cases) -* :ghpull:`28947`: Backport PR #28925 on branch v3.9.x (TST: handle change in pytest.importorskip behavior) -* :ghpull:`28989`: Backport PR #28972 on branch v3.9.x (Switch macOS 12 runner images to macOS 13) -* :ghpull:`28972`: Switch macOS 12 runner images to macOS 13 -* :ghpull:`28987`: Fix: Do not use numeric tolerances for axline special cases -* :ghpull:`28954`: Backport PR #28952 on branch v3.9.x (BLD: update trove metadata to support py3.13) -* :ghpull:`28952`: BLD: update trove metadata to support py3.13 -* :ghpull:`28887`: Backport PR #28883 on branch v3.9.x (Only check X11 when running Tkinter tests) -* :ghpull:`28926`: Backport PR #28689 on branch v3.9.x (ci: Enable testing on Python 3.13) -* :ghpull:`28925`: TST: handle change in pytest.importorskip behavior -* :ghpull:`28945`: Backport PR #28943 on branch v3.9.x (DOC: Clarify the returned line of axhline()/axvline()) -* :ghpull:`28939`: Backport PR #28900 on branch v3.9.x (DOC: Improve fancybox demo) -* :ghpull:`28900`: DOC: Improve fancybox demo -* :ghpull:`28902`: Backport PR #28881 on branch v3.9.x (Fix ``axline`` for slopes <= 1E-8. Closes #28386) -* :ghpull:`28431`: Fix ``axline`` for slopes < 1E-8 -* :ghpull:`28881`: Fix ``axline`` for slopes <= 1E-8. Closes #28386 -* :ghpull:`28883`: Only check X11 when running Tkinter tests -* :ghpull:`28859`: Backport PR #28858 on branch v3.9.x (Fix flaky labelcolor tests) -* :ghpull:`28858`: Fix flaky labelcolor tests -* :ghpull:`28839`: Backport PR #28836 on branch v3.9.x (MNT: Use __init__ parameters of font properties) -* :ghpull:`28836`: MNT: Use __init__ parameters of font properties -* :ghpull:`28828`: Backport PR #28818 on branch v3.9.x (Resolve configdir so that it's not a symlink when is_dir() is called) -* :ghpull:`28818`: Resolve configdir so that it's not a symlink when is_dir() is called -* :ghpull:`28811`: Backport PR #28810 on branch v3.9.x (Document how to obtain sans-serif usetex math.) -* :ghpull:`28806`: Backport PR #28805 on branch v3.9.x (add brackets to satisfy the new sequence requirement) -* :ghpull:`28802`: Backport PR #28798 on branch v3.9.x (DOC: Correctly list modules that have been internalized) -* :ghpull:`28791`: Backport PR #28790 on branch v3.9.x (DOC: Fix duplicate Figure.set_dpi entry) -* :ghpull:`28787`: Backport PR #28706 on branch v3.9.x (Add Returns info to to_jshtml docstring) -* :ghpull:`28706`: Add Returns info to to_jshtml docstring -* :ghpull:`28751`: Backport PR #28271 on branch v3.9.x (Fix draggable legend disappearing when picking while use_blit=True) -* :ghpull:`28271`: Fix draggable legend disappearing when picking while use_blit=True -* :ghpull:`28747`: Backport PR #28743 on branch v3.9.x (Minor fixes in ticker docs) -* :ghpull:`28743`: Minor fixes in ticker docs -* :ghpull:`28738`: Backport PR #28737 on branch v3.9.x (TST: Fix image comparison directory for test_striped_lines) -* :ghpull:`28740`: Backport PR #28739 on branch v3.9.x (Tweak interactivity docs wording (and fix capitalization).) -* :ghpull:`28737`: TST: Fix image comparison directory for test_striped_lines -* :ghpull:`28733`: Backport PR #28732 on branch v3.9.x (Renames the minumumSizeHint method to minimumSizeHint) -* :ghpull:`28732`: Renames the minumumSizeHint method to minimumSizeHint -* :ghpull:`28689`: ci: Enable testing on Python 3.13 -* :ghpull:`28724`: Backport fixes from #28711 +* :ghpull:`29297`: Backport PR #29295 on branch v3.9.x (BLD: Pin meson-python to <0.17.0) +* :ghpull:`29295`: BLD: Pin meson-python to <0.17.0 +* :ghpull:`29175`: addressing issue #29156, converted ps to array before slicing -Issues (6): +Issues (2): -* :ghissue:`28960`: [Bug]: High CPU utilization of the macosx backend -* :ghissue:`28990`: [Bug]: no longer able to set multiple hatch colors -* :ghissue:`28870`: [Bug]: axline doesn't work with some axes scales -* :ghissue:`28386`: [Bug]: Minor issue - Drawing an axline sets slopes less than 1E-8 to 0 -* :ghissue:`28817`: [Bug]: ``~/.config/matplotlib`` is never used because ``~/.config`` is a symlink -* :ghissue:`28716`: Size hint method in Qt backend should be named ``minimumSizeHint``, not ``minumumSizeHint`` +* :ghissue:`29229`: [Bug]: Icons do not work with GTK +* :ghissue:`29156`: [Bug]: Poly3DCollection initialization cannot properly handle parameter verts when it is a list of nested tuples and shade is False Previous GitHub statistics diff --git a/doc/users/prev_whats_new/github_stats_3.9.3.rst b/doc/users/prev_whats_new/github_stats_3.9.3.rst new file mode 100644 index 000000000000..06f0232c338c --- /dev/null +++ b/doc/users/prev_whats_new/github_stats_3.9.3.rst @@ -0,0 +1,108 @@ +.. _github-stats-3-9-3: + +GitHub statistics for 3.9.3 (Nov 30, 2024) +========================================== + +GitHub statistics for 2024/08/12 (tag: v3.9.2) - 2024/11/30 + +These lists are automatically generated, and may be incomplete or contain duplicates. + +We closed 6 issues and merged 62 pull requests. +The full list can be seen `on GitHub `__ + +The following 18 authors contributed 90 commits. + +* Andresporcruz +* Antony Lee +* Charlie LeWarne +* dependabot[bot] +* Elliott Sales de Andrade +* Gavin S +* Greg Lucas +* hannah +* Kyle Sunden +* Kyra Cho +* kyracho +* Lumberbot (aka Jack) +* Michael Hinton +* Oscar Gustafsson +* Ruth Comer +* Thomas A Caswell +* Tim Hoffmann +* vittoboa + +GitHub issues and pull requests: + +Pull Requests (62): + +* :ghpull:`29195`: Backport PR #29191 on branch v3.9.x (ci: Simplify 3.13t test setup) +* :ghpull:`29191`: ci: Simplify 3.13t test setup +* :ghpull:`29176`: Backport PR #29148 on branch v3.9.x (Don't fail on equal-but-differently-named cmaps in qt figureoptions.) +* :ghpull:`29148`: Don't fail on equal-but-differently-named cmaps in qt figureoptions. +* :ghpull:`29165`: Backport PR #29153 on branch v3.9.x (Bump codecov/codecov-action from 4 to 5 in the actions group) +* :ghpull:`29153`: Bump codecov/codecov-action from 4 to 5 in the actions group +* :ghpull:`29149`: Backport CI config updates to v3.9.x +* :ghpull:`29121`: Backport PR #29120 on branch v3.9.x (DOC: Switch nested pie example from cmaps to color_sequences) +* :ghpull:`29071`: Bump pypa/gh-action-pypi-publish from 1.10.3 to 1.11.0 in the actions group +* :ghpull:`29046`: Backport PR #28981 on branch v3.9.x (FIX: macos: Use standard NSApp run loop in our input hook) +* :ghpull:`28981`: FIX: macos: Use standard NSApp run loop in our input hook +* :ghpull:`29041`: Backport PR #29035 on branch v3.9.x (FIX: Don't set_wmclass on GTK3) +* :ghpull:`29035`: FIX: Don't set_wmclass on GTK3 +* :ghpull:`29037`: Backport PR #29036 on branch v3.9.x (Don't pass redundant inline=True to example clabel() calls.) +* :ghpull:`29032`: Backport PR #27569 on branch v3.9.x (DOC: initial tags for statistics section of gallery) +* :ghpull:`29034`: Backport PR #29031 on branch v3.9.x (DOC: Fix copy-paste typo in ColorSequenceRegistry) +* :ghpull:`29031`: DOC: Fix copy-paste typo in ColorSequenceRegistry +* :ghpull:`29015`: Backport PR #29014 on branch v3.9.x (FIX: fake out setuptools scm in tox on ci) +* :ghpull:`29014`: FIX: fake out setuptools scm in tox on ci +* :ghpull:`29010`: Backport PR #29005 on branch v3.9.x (DOC: Update meson-python intersphinx link) +* :ghpull:`29006`: Backport PR #28993 on branch v3.9.x (FIX: contourf hatches use multiple edgecolors) +* :ghpull:`28993`: FIX: contourf hatches use multiple edgecolors +* :ghpull:`28988`: Backport PR #28987 on branch v3.9.x (Fix: Do not use numeric tolerances for axline special cases) +* :ghpull:`28947`: Backport PR #28925 on branch v3.9.x (TST: handle change in pytest.importorskip behavior) +* :ghpull:`28989`: Backport PR #28972 on branch v3.9.x (Switch macOS 12 runner images to macOS 13) +* :ghpull:`28972`: Switch macOS 12 runner images to macOS 13 +* :ghpull:`28987`: Fix: Do not use numeric tolerances for axline special cases +* :ghpull:`28954`: Backport PR #28952 on branch v3.9.x (BLD: update trove metadata to support py3.13) +* :ghpull:`28952`: BLD: update trove metadata to support py3.13 +* :ghpull:`28887`: Backport PR #28883 on branch v3.9.x (Only check X11 when running Tkinter tests) +* :ghpull:`28926`: Backport PR #28689 on branch v3.9.x (ci: Enable testing on Python 3.13) +* :ghpull:`28925`: TST: handle change in pytest.importorskip behavior +* :ghpull:`28945`: Backport PR #28943 on branch v3.9.x (DOC: Clarify the returned line of axhline()/axvline()) +* :ghpull:`28939`: Backport PR #28900 on branch v3.9.x (DOC: Improve fancybox demo) +* :ghpull:`28900`: DOC: Improve fancybox demo +* :ghpull:`28902`: Backport PR #28881 on branch v3.9.x (Fix ``axline`` for slopes <= 1E-8. Closes #28386) +* :ghpull:`28431`: Fix ``axline`` for slopes < 1E-8 +* :ghpull:`28881`: Fix ``axline`` for slopes <= 1E-8. Closes #28386 +* :ghpull:`28883`: Only check X11 when running Tkinter tests +* :ghpull:`28859`: Backport PR #28858 on branch v3.9.x (Fix flaky labelcolor tests) +* :ghpull:`28858`: Fix flaky labelcolor tests +* :ghpull:`28839`: Backport PR #28836 on branch v3.9.x (MNT: Use __init__ parameters of font properties) +* :ghpull:`28836`: MNT: Use __init__ parameters of font properties +* :ghpull:`28828`: Backport PR #28818 on branch v3.9.x (Resolve configdir so that it's not a symlink when is_dir() is called) +* :ghpull:`28818`: Resolve configdir so that it's not a symlink when is_dir() is called +* :ghpull:`28811`: Backport PR #28810 on branch v3.9.x (Document how to obtain sans-serif usetex math.) +* :ghpull:`28806`: Backport PR #28805 on branch v3.9.x (add brackets to satisfy the new sequence requirement) +* :ghpull:`28802`: Backport PR #28798 on branch v3.9.x (DOC: Correctly list modules that have been internalized) +* :ghpull:`28791`: Backport PR #28790 on branch v3.9.x (DOC: Fix duplicate Figure.set_dpi entry) +* :ghpull:`28787`: Backport PR #28706 on branch v3.9.x (Add Returns info to to_jshtml docstring) +* :ghpull:`28706`: Add Returns info to to_jshtml docstring +* :ghpull:`28751`: Backport PR #28271 on branch v3.9.x (Fix draggable legend disappearing when picking while use_blit=True) +* :ghpull:`28271`: Fix draggable legend disappearing when picking while use_blit=True +* :ghpull:`28747`: Backport PR #28743 on branch v3.9.x (Minor fixes in ticker docs) +* :ghpull:`28743`: Minor fixes in ticker docs +* :ghpull:`28738`: Backport PR #28737 on branch v3.9.x (TST: Fix image comparison directory for test_striped_lines) +* :ghpull:`28740`: Backport PR #28739 on branch v3.9.x (Tweak interactivity docs wording (and fix capitalization).) +* :ghpull:`28737`: TST: Fix image comparison directory for test_striped_lines +* :ghpull:`28733`: Backport PR #28732 on branch v3.9.x (Renames the minumumSizeHint method to minimumSizeHint) +* :ghpull:`28732`: Renames the minumumSizeHint method to minimumSizeHint +* :ghpull:`28689`: ci: Enable testing on Python 3.13 +* :ghpull:`28724`: Backport fixes from #28711 + +Issues (6): + +* :ghissue:`28960`: [Bug]: High CPU utilization of the macosx backend +* :ghissue:`28990`: [Bug]: no longer able to set multiple hatch colors +* :ghissue:`28870`: [Bug]: axline doesn't work with some axes scales +* :ghissue:`28386`: [Bug]: Minor issue - Drawing an axline sets slopes less than 1E-8 to 0 +* :ghissue:`28817`: [Bug]: ``~/.config/matplotlib`` is never used because ``~/.config`` is a symlink +* :ghissue:`28716`: Size hint method in Qt backend should be named ``minimumSizeHint``, not ``minumumSizeHint`` diff --git a/doc/users/release_notes.rst b/doc/users/release_notes.rst index 010f9b7534bc..aed9cdda26ee 100644 --- a/doc/users/release_notes.rst +++ b/doc/users/release_notes.rst @@ -23,6 +23,7 @@ Version 3.9 ../api/prev_api_changes/api_changes_3.9.1.rst ../api/prev_api_changes/api_changes_3.9.0.rst github_stats.rst + prev_whats_new/github_stats_3.9.3.rst prev_whats_new/github_stats_3.9.2.rst prev_whats_new/github_stats_3.9.1.rst prev_whats_new/github_stats_3.9.0.rst From a42d0eda5649da865361e88ad18776909f981e9d Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Fri, 13 Dec 2024 21:45:13 -0500 Subject: [PATCH 109/131] Backport PR #29242: DOC: Add kwdoc list to scatter() docstring --- doc/missing-references.json | 2 ++ lib/matplotlib/axes/_axes.py | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/doc/missing-references.json b/doc/missing-references.json index 61662066f639..1a816d19f7cd 100644 --- a/doc/missing-references.json +++ b/doc/missing-references.json @@ -301,6 +301,7 @@ "lib/matplotlib/axes/_axes.py:docstring of matplotlib.axes._axes.Axes.hexbin:218", "lib/matplotlib/axes/_axes.py:docstring of matplotlib.axes._axes.Axes.pcolor:187", "lib/matplotlib/axes/_axes.py:docstring of matplotlib.axes._axes.Axes.quiver:256", + "lib/matplotlib/axes/_axes.py:docstring of matplotlib.axes._axes.Axes.scatter:174", "lib/matplotlib/collections.py:docstring of matplotlib.artist.AsteriskPolygonCollection.set:45", "lib/matplotlib/collections.py:docstring of matplotlib.artist.CircleCollection.set:45", "lib/matplotlib/collections.py:docstring of matplotlib.artist.FillBetweenPolyCollection.set:46", @@ -316,6 +317,7 @@ "lib/matplotlib/pyplot.py:docstring of matplotlib.pyplot.hexbin:218", "lib/matplotlib/pyplot.py:docstring of matplotlib.pyplot.pcolor:187", "lib/matplotlib/pyplot.py:docstring of matplotlib.pyplot.quiver:256", + "lib/matplotlib/pyplot.py:docstring of matplotlib.pyplot.scatter:174", "lib/matplotlib/quiver.py:docstring of matplotlib.artist.Barbs.set:46", "lib/matplotlib/quiver.py:docstring of matplotlib.artist.Quiver.set:46", "lib/matplotlib/quiver.py:docstring of matplotlib.quiver.Barbs:213", diff --git a/lib/matplotlib/axes/_axes.py b/lib/matplotlib/axes/_axes.py index b9df5af948f4..679499a4eab3 100644 --- a/lib/matplotlib/axes/_axes.py +++ b/lib/matplotlib/axes/_axes.py @@ -4855,7 +4855,8 @@ def scatter(self, x, y, s=None, c=None, marker=None, cmap=None, norm=None, ---------------- data : indexable object, optional DATA_PARAMETER_PLACEHOLDER - **kwargs : `~matplotlib.collections.Collection` properties + **kwargs : `~matplotlib.collections.PathCollection` properties + %(PathCollection:kwdoc)s See Also -------- From cdecf97555a269c19dc9487860eb7c3ad900861b Mon Sep 17 00:00:00 2001 From: Kyle Sunden Date: Fri, 13 Dec 2024 16:02:47 -0600 Subject: [PATCH 110/131] Update github stats for 3.10 --- doc/users/github_stats.rst | 134 ++++++++++++++++++++++++++++++++++--- 1 file changed, 126 insertions(+), 8 deletions(-) diff --git a/doc/users/github_stats.rst b/doc/users/github_stats.rst index 914f59fc32c7..c12a983aa6a8 100644 --- a/doc/users/github_stats.rst +++ b/doc/users/github_stats.rst @@ -1,21 +1,22 @@ .. _github-stats: -GitHub statistics for 3.10.0rc1 (Oct 31, 2024) -============================================== +GitHub statistics for 3.10.0 (Dec 13, 2024) +=========================================== -GitHub statistics for 2024/05/15 (tag: v3.9.0) - 2024/10/31 +GitHub statistics for 2024/05/15 (tag: v3.9.0) - 2024/12/13 These lists are automatically generated, and may be incomplete or contain duplicates. -We closed 87 issues and merged 244 pull requests. +We closed 100 issues and merged 337 pull requests. The full list can be seen `on GitHub `__ -The following 116 authors contributed 1650 commits. +The following 128 authors contributed 1932 commits. * abhi-jha * Adam J. Stewart * Aditi Gautam * Aditya Vidyadhar Kamath +* Aishling Cooke * Alan * Alan Sosa * Alice @@ -34,11 +35,14 @@ The following 116 authors contributed 1650 commits. * Charlie LeWarne * Christian Mattsson * ClarkeAC +* Clemens Brunner * Clement Gilli * cmp0xff * Costa Paraskevopoulos * dale * Dani Pinyol +* Daniel Weiss +* Danny * David Bakaj * David Lowry-Duda * David Meyer @@ -54,6 +58,7 @@ The following 116 authors contributed 1650 commits. * Felipe Cybis Pereira * Filippo Balzaretti * FMasson +* Francisco Cardozo * Gavin S * Greg Lucas * haaris @@ -75,7 +80,10 @@ The following 116 authors contributed 1650 commits. * Kherim Willems * Kyle Sunden * Kyra Cho +* Larry Bradley +* litchi * Lorenzo +* Lucx33 * Lumberbot (aka Jack) * MadPhysicist * malhar2460 @@ -104,12 +112,15 @@ The following 116 authors contributed 1650 commits. * Pranav * Pranav Raghu * pre-commit-ci[bot] +* proximalf * r3kste * Randolf Scholz * Refael Ackermann * RickyP24 * rnhmjoj * Ruth Comer +* Ryan May +* Sai Chaitanya, Sanivada * saranti * scaccol * Scott Shambaugh @@ -126,13 +137,107 @@ The following 116 authors contributed 1650 commits. * Tim Hoffmann * trananso * Trygve Magnus Ræder +* Victor Liu * vittoboa * Xeniya Shoiko GitHub issues and pull requests: -Pull Requests (244): +Pull Requests (337): +* :ghpull:`29299`: Merge v3.9.x into v3.10.x +* :ghpull:`29296`: Backport PR #29295 on branch v3.10.x (BLD: Pin meson-python to <0.17.0) +* :ghpull:`29290`: Backport PR #29254 on branch v3.10.x (DOC: Add note to align_labels()) +* :ghpull:`29289`: Backport PR #29260 on branch v3.10.x (DOC: Better explanation of rcParams "patch.edgecolor" and "patch.force_edgecolor") +* :ghpull:`29288`: Backport PR #29285 on branch v3.10.x (Retarget PR#29175 to main) +* :ghpull:`29254`: DOC: Add note to align_labels() +* :ghpull:`29260`: DOC: Better explanation of rcParams "patch.edgecolor" and "patch.force_edgecolor" +* :ghpull:`29285`: Retarget PR#29175 to main +* :ghpull:`29286`: Backport PR #29274 on branch v3.10.x (Bump the actions group across 1 directory with 2 updates) +* :ghpull:`29274`: Bump the actions group across 1 directory with 2 updates +* :ghpull:`29283`: Backport PR #29272 on branch v3.10.x (DOC: Add section on translating between Axes and pyplot interface) +* :ghpull:`29272`: DOC: Add section on translating between Axes and pyplot interface +* :ghpull:`29279`: Backport PR #29265 on branch v3.10.x (DOC: Slightly improve the LineCollection docstring) +* :ghpull:`29276`: Backport PR #29247 on branch v3.10.x (Fix building freetype 2.6.1 on macOS clang 18) +* :ghpull:`29244`: Switch to a 3d rotation trackball implementation with path independence +* :ghpull:`29265`: DOC: Slightly improve the LineCollection docstring +* :ghpull:`29247`: Fix building freetype 2.6.1 on macOS clang 18 +* :ghpull:`29268`: Bump the actions group with 2 updates +* :ghpull:`29266`: Backport PR #29251 on branch v3.10.x (Zizmor audit) +* :ghpull:`29269`: Backport PR #29267 on branch v3.10.x (Exclude pylab from mypy checks) +* :ghpull:`29267`: Exclude pylab from mypy checks +* :ghpull:`29251`: Zizmor audit +* :ghpull:`29255`: Backport PR #29249 on branch v3.10.x ([Bug Fix] Fix reverse mapping for _translate_tick_params) +* :ghpull:`29249`: [Bug Fix] Fix reverse mapping for _translate_tick_params +* :ghpull:`29250`: Backport PR #29243 on branch v3.10.x (Add quotes around [dev] in environment.yml) +* :ghpull:`29243`: Add quotes around [dev] in environment.yml +* :ghpull:`29246`: Backport PR #29240 on branch v3.10.x (DOC: Add plt.show() to introductory pyplot example) +* :ghpull:`29240`: DOC: Add plt.show() to introductory pyplot example +* :ghpull:`29239`: Backport PR #29236 on branch v3.10.x (ANI: Reduce Pillow frames to RGB when opaque) +* :ghpull:`29238`: Backport PR #29167 on branch v3.10.x (BUGFIX: use axes unit information in ConnectionPatch ) +* :ghpull:`29236`: ANI: Reduce Pillow frames to RGB when opaque +* :ghpull:`29167`: BUGFIX: use axes unit information in ConnectionPatch +* :ghpull:`29232`: Merge branch v3.9.x into v3.10.x +* :ghpull:`29230`: Backport PR #29188 on branch v3.10.x (Bump pypa/cibuildwheel from 2.21.3 to 2.22.0 in the actions group) +* :ghpull:`29188`: Bump pypa/cibuildwheel from 2.21.3 to 2.22.0 in the actions group +* :ghpull:`29225`: Backport PR #29213 on branch v3.10.x (avoid-unnecessary-warning-in-_pcolorargs-function) +* :ghpull:`29211`: Backport PR #29133 on branch v3.10.x (Creating_parse_bar_color_args to unify color handling in plt.bar with precedence and sequence support for facecolor and edgecolor) +* :ghpull:`29177`: Backport PR #29148 on branch v3.10.x (Don't fail on equal-but-differently-named cmaps in qt figureoptions.) +* :ghpull:`29226`: Backport PR #29206 on branch v3.10.x (Skip more tests on pure-Wayland systems) +* :ghpull:`29206`: Skip more tests on pure-Wayland systems +* :ghpull:`29213`: avoid-unnecessary-warning-in-_pcolorargs-function +* :ghpull:`29210`: Backport PR #29209 on branch v3.10.x (FIX: pcolormesh with no x y args and nearest interp) +* :ghpull:`29133`: Creating_parse_bar_color_args to unify color handling in plt.bar with precedence and sequence support for facecolor and edgecolor +* :ghpull:`29209`: FIX: pcolormesh with no x y args and nearest interp +* :ghpull:`29200`: Backport PR #29182 on branch v3.10.x (Update backend_qt.py: parent not passed to __init__ on subplottool) +* :ghpull:`29207`: Backport PR #29169 on branch v3.10.x (Minor fixes to text intro explainer) +* :ghpull:`29169`: Minor fixes to text intro explainer +* :ghpull:`29159`: Pending warning for deprecated parameter 'vert' of box and violin on 3.10 +* :ghpull:`29196`: Backport PR #29191 on branch v3.10.x (ci: Simplify 3.13t test setup) +* :ghpull:`29182`: Update backend_qt.py: parent not passed to __init__ on subplottool +* :ghpull:`29189`: Backport PR #28934 on branch v3.10.x (ci: Unpin micromamba again) +* :ghpull:`29186`: Backport PR #28335 on branch v3.10.x (DOC: do not posting LLM output as your own work) +* :ghpull:`28934`: ci: Unpin micromamba again +* :ghpull:`28335`: DOC: do not posting LLM output as your own work +* :ghpull:`29178`: Backport PR #29163 on branch v3.9.x (ci: Remove outdated pkg-config package on macOS) +* :ghpull:`29170`: Backport PR #29154 on branch v3.10.x (Relax conditions for warning on updating converters) +* :ghpull:`29154`: Relax conditions for warning on updating converters +* :ghpull:`29166`: Backport PR #29153 on branch v3.10.x (Bump codecov/codecov-action from 4 to 5 in the actions group) +* :ghpull:`29164`: Backport PR #29163 on branch v3.10.x (ci: Remove outdated pkg-config package on macOS) +* :ghpull:`29168`: Backport PR #29073 on branch v3.10.x (Update secondary_axis tutorial) +* :ghpull:`29073`: Update secondary_axis tutorial +* :ghpull:`29163`: ci: Remove outdated pkg-config package on macOS +* :ghpull:`29145`: Backport PR #29144 on branch v3.10.x (Use both TCL_SETVAR and TCL_SETVAR2 for tcl 9 support) +* :ghpull:`29144`: Use both TCL_SETVAR and TCL_SETVAR2 for tcl 9 support +* :ghpull:`29140`: Backport PR #29080 on branch v3.10.x (Updates the ``galleries/tutorials/artists.py`` file in response to issue #28920) +* :ghpull:`29080`: Updates the ``galleries/tutorials/artists.py`` file in response to issue #28920 +* :ghpull:`29138`: Backport PR #29134 on branch v3.10.x (MNT: Temporarily skip failing test to unbreak CI) +* :ghpull:`29134`: MNT: Temporarily skip failing test to unbreak CI +* :ghpull:`29132`: Backport PR #29128 on branch v3.10.x (Tweak AutoMinorLocator docstring.) +* :ghpull:`29128`: Tweak AutoMinorLocator docstring. +* :ghpull:`29123`: Bump the actions group with 2 updates +* :ghpull:`29122`: Backport PR #29120 on branch v3.10.x (DOC: Switch nested pie example from cmaps to color_sequences) +* :ghpull:`29100`: Backport PR #29099 on branch v3.10.x (MNT: remove _ttconv.pyi) +* :ghpull:`29099`: MNT: remove _ttconv.pyi +* :ghpull:`29098`: Backport PR #29097 on branch v3.10.x (ENH: add back/forward buttons to osx backend move) +* :ghpull:`29097`: ENH: add back/forward buttons to osx backend move +* :ghpull:`29095`: Backport PR #29071 on branch v3.10.x (Bump pypa/gh-action-pypi-publish from 1.10.3 to 1.11.0 in the actions group) +* :ghpull:`29096`: Backport PR #29094 on branch v3.10.x (DOC: fix link in See Also section of axes.violin) +* :ghpull:`29092`: Backport PR #29088 on branch v3.10.x (DOC: Format aliases in kwargs tables) +* :ghpull:`29094`: DOC: fix link in See Also section of axes.violin +* :ghpull:`29091`: Backport PR #29085 on branch v3.10.x (FIX: Update GTK3Agg backend export name for consistency) +* :ghpull:`29088`: DOC: Format aliases in kwargs tables +* :ghpull:`29089`: Backport PR #29065 on branch v3.10.x (DOC: Update docstring of triplot()) +* :ghpull:`29085`: FIX: Update GTK3Agg backend export name for consistency +* :ghpull:`29084`: Backport PR #29081 on branch v3.10.x (Document "none" as color value) +* :ghpull:`29065`: DOC: Update docstring of triplot() +* :ghpull:`29081`: Document "none" as color value +* :ghpull:`29061`: Backport PR #29024 on branch v3.10.x (Fix saving animations to transparent formats) +* :ghpull:`29069`: Backport PR #29068 on branch v3.10.x ([DOC] Fix indentation in sync_cmaps example) +* :ghpull:`29070`: Backport PR #29048 on branch v3.10.x (DOC: integrated pr workflow from contributing guide into install and workflow) +* :ghpull:`29048`: DOC: integrated pr workflow from contributing guide into install and workflow +* :ghpull:`29068`: [DOC] Fix indentation in sync_cmaps example +* :ghpull:`29024`: Fix saving animations to transparent formats * :ghpull:`29059`: Cleanup converter docs and StrCategoryConverter behavior * :ghpull:`29058`: [DOC] Update missing-references.json * :ghpull:`29057`: DOC/TST: lock numpy<2.1 in environment.yml @@ -378,12 +483,25 @@ Pull Requests (244): * :ghpull:`28037`: DOC: Fix inconsistent spacing in some docstrings in _axes.py * :ghpull:`28031`: Be more specific in findobj return type -Issues (87): +Issues (100): +* :ghissue:`29298`: [Doc]: The link at "see also" is incorrect. (Axes.violin) +* :ghissue:`29248`: [Bug]: Figure.align_labels() confused by GridSpecFromSubplotSpec +* :ghissue:`26738`: Improve LineCollection docstring further +* :ghissue:`29263`: [Bug]: mypy failures in CI +* :ghissue:`27416`: [Bug]: get_tick_params on xaxis shows wrong keywords +* :ghissue:`29241`: [Bug]: Instructions for setting up conda dev environment in environment.yml give issues with MacOS/zsh +* :ghissue:`29227`: [Bug]: Introductory example on the pyplot API page does not show - missing plt.show() +* :ghissue:`29190`: [Bug]: inconsistent ‘animation.FuncAnimation’ between display and save +* :ghissue:`29090`: [MNT]: More consistent color parameters for bar() +* :ghissue:`29179`: [Bug]: Incorrect pcolormesh when shading='nearest' and only the mesh data C is provided. +* :ghissue:`29067`: [Bug]: ``secondary_xaxis`` produces ticks at incorrect locations +* :ghissue:`29126`: [Bug]: TkAgg backend is broken with tcl/tk 9.0 +* :ghissue:`29045`: [ENH]: implement back/forward buttons on mouse move events on macOS +* :ghissue:`27173`: [Bug]: Gifs no longer create transparent background * :ghissue:`19229`: Add public API for setting an axis unit converter * :ghissue:`21108`: [Bug]: Hatch linewidths cannot be modified in an rcParam context * :ghissue:`27784`: [Bug]: Polar plot error bars don't rotate with angle for ``set_theta_direction`` and ``set_theta_offset`` -* :ghissue:`28944`: [Bug]: calling title before making polar plot * :ghissue:`29011`: [Bug]: Figure.autofmt_xdate() not working in presence of colorbar with constrained layout * :ghissue:`29020`: AIX internal CI build break #Matplotlib * :ghissue:`28726`: feature request: support passing DataFrames to table.table From 87a603f17843eabfb4b24016adb016481a1e7f5c Mon Sep 17 00:00:00 2001 From: Kyle Sunden Date: Fri, 13 Dec 2024 17:14:14 -0600 Subject: [PATCH 111/131] Update release notes for 3.10.0 --- SECURITY.md | 7 +- doc/_static/switcher.json | 11 +- doc/api/next_api_changes/behavior/26000-t.rst | 5 - .../next_api_changes/behavior/27744-FM.rst | 10 - .../next_api_changes/behavior/27833-JA.rst | 8 - .../next_api_changes/behavior/27891-ES.rst | 5 - .../next_api_changes/behavior/27996-REC.rst | 8 - .../next_api_changes/behavior/28061-JMK.rst | 23 - .../next_api_changes/behavior/28156-AL.rst | 12 - .../next_api_changes/behavior/28177-REC.rst | 7 - .../next_api_changes/behavior/28354-YN.rst | 4 - .../next_api_changes/behavior/28363-TS.rst | 6 - .../next_api_changes/behavior/28375-MP.rst | 5 - .../next_api_changes/behavior/28501-OV.rst | 5 - .../next_api_changes/behavior/28734-REC.rst | 7 - .../deprecations/27385-SS.rst | 3 - .../deprecations/27786-TH.rst | 7 - .../deprecations/28007-TH.rst | 6 - .../deprecations/28048-PR.rst | 4 - .../deprecations/28177-REC.rst | 5 - .../deprecations/28201-AT.rst | 3 - .../deprecations/28670-TAC.rst | 6 - .../deprecations/28728-TH.rst | 10 - .../deprecations/28842-ES.rst | 55 -- .../deprecations/28843-TH.rst | 9 - .../deprecations/28933-AL.rst | 5 - .../deprecations/28946-TH.rst | 6 - .../deprecations/28967-ES.rst | 12 - .../next_api_changes/development/28289-ES.rst | 7 - .../next_api_changes/removals/20866-JKS.rst | 7 - .../next_api_changes/removals/27218-TAC.rst | 7 - .../next_api_changes/removals/27891-ES.rst | 4 - .../next_api_changes/removals/28183-OG.rst | 62 --- .../next_api_changes/removals/28492-GML.rst | 9 - .../next_api_changes/removals/28767-REC.rst | 31 -- .../prev_api_changes/api_changes_3.10.0.rst | 14 + .../api_changes_3.10.0/behavior.rst | 118 +++++ .../api_changes_3.10.0/deprecations.rst | 164 ++++++ .../api_changes_3.10.0/development.rst} | 8 + .../api_changes_3.10.0/removals.rst} | 123 +++++ .../next_whats_new/3d_clip_to_axis_limits.rst | 34 -- .../next_whats_new/axes_creation_speedup.rst | 4 - .../next_whats_new/boxplot_orientation.rst | 21 - doc/users/next_whats_new/ccs_color_cycle.rst | 19 - doc/users/next_whats_new/contour_color.rst | 21 - .../next_whats_new/diverging_colormaps.rst | 24 - .../next_whats_new/engformatter_offset.rst | 13 - .../next_whats_new/exception_prop_name.rst | 26 - doc/users/next_whats_new/fill_between_3d.rst | 25 - .../fill_between_poly_collection.rst | 22 - doc/users/next_whats_new/freethreading.rst | 22 - .../histogram_vectorized_parameters.rst | 46 -- .../increased_figure_limits.rst | 9 - doc/users/next_whats_new/inset_indicator.rst | 18 - doc/users/next_whats_new/mouse_rotation.rst | 45 -- .../mpl_toolkit_colorbar_pad.rst | 6 - .../pass_pandasDataFrame_into_table.rst | 20 - .../subfigures_change_order.rst | 29 -- doc/users/next_whats_new/svg_id_rc.rst | 32 -- doc/users/next_whats_new/update_features.rst | 4 - .../next_whats_new/violinplot_orientation.rst | 21 - doc/users/prev_whats_new/whats_new_3.10.0.rst | 479 ++++++++++++++++++ doc/users/release_notes.rst | 8 + 63 files changed, 925 insertions(+), 831 deletions(-) delete mode 100644 doc/api/next_api_changes/behavior/26000-t.rst delete mode 100644 doc/api/next_api_changes/behavior/27744-FM.rst delete mode 100644 doc/api/next_api_changes/behavior/27833-JA.rst delete mode 100644 doc/api/next_api_changes/behavior/27891-ES.rst delete mode 100644 doc/api/next_api_changes/behavior/27996-REC.rst delete mode 100644 doc/api/next_api_changes/behavior/28061-JMK.rst delete mode 100644 doc/api/next_api_changes/behavior/28156-AL.rst delete mode 100644 doc/api/next_api_changes/behavior/28177-REC.rst delete mode 100644 doc/api/next_api_changes/behavior/28354-YN.rst delete mode 100644 doc/api/next_api_changes/behavior/28363-TS.rst delete mode 100644 doc/api/next_api_changes/behavior/28375-MP.rst delete mode 100644 doc/api/next_api_changes/behavior/28501-OV.rst delete mode 100644 doc/api/next_api_changes/behavior/28734-REC.rst delete mode 100644 doc/api/next_api_changes/deprecations/27385-SS.rst delete mode 100644 doc/api/next_api_changes/deprecations/27786-TH.rst delete mode 100644 doc/api/next_api_changes/deprecations/28007-TH.rst delete mode 100644 doc/api/next_api_changes/deprecations/28048-PR.rst delete mode 100644 doc/api/next_api_changes/deprecations/28177-REC.rst delete mode 100644 doc/api/next_api_changes/deprecations/28201-AT.rst delete mode 100644 doc/api/next_api_changes/deprecations/28670-TAC.rst delete mode 100644 doc/api/next_api_changes/deprecations/28728-TH.rst delete mode 100644 doc/api/next_api_changes/deprecations/28842-ES.rst delete mode 100644 doc/api/next_api_changes/deprecations/28843-TH.rst delete mode 100644 doc/api/next_api_changes/deprecations/28933-AL.rst delete mode 100644 doc/api/next_api_changes/deprecations/28946-TH.rst delete mode 100644 doc/api/next_api_changes/deprecations/28967-ES.rst delete mode 100644 doc/api/next_api_changes/development/28289-ES.rst delete mode 100644 doc/api/next_api_changes/removals/20866-JKS.rst delete mode 100644 doc/api/next_api_changes/removals/27218-TAC.rst delete mode 100644 doc/api/next_api_changes/removals/27891-ES.rst delete mode 100644 doc/api/next_api_changes/removals/28183-OG.rst delete mode 100644 doc/api/next_api_changes/removals/28492-GML.rst delete mode 100644 doc/api/next_api_changes/removals/28767-REC.rst create mode 100644 doc/api/prev_api_changes/api_changes_3.10.0.rst create mode 100644 doc/api/prev_api_changes/api_changes_3.10.0/behavior.rst create mode 100644 doc/api/prev_api_changes/api_changes_3.10.0/deprecations.rst rename doc/api/{next_api_changes/development/28503-ES.rst => prev_api_changes/api_changes_3.10.0/development.rst} (56%) rename doc/api/{next_api_changes/removals/28874-ES.rst => prev_api_changes/api_changes_3.10.0/removals.rst} (58%) delete mode 100644 doc/users/next_whats_new/3d_clip_to_axis_limits.rst delete mode 100644 doc/users/next_whats_new/axes_creation_speedup.rst delete mode 100644 doc/users/next_whats_new/boxplot_orientation.rst delete mode 100644 doc/users/next_whats_new/ccs_color_cycle.rst delete mode 100644 doc/users/next_whats_new/contour_color.rst delete mode 100644 doc/users/next_whats_new/diverging_colormaps.rst delete mode 100644 doc/users/next_whats_new/engformatter_offset.rst delete mode 100644 doc/users/next_whats_new/exception_prop_name.rst delete mode 100644 doc/users/next_whats_new/fill_between_3d.rst delete mode 100644 doc/users/next_whats_new/fill_between_poly_collection.rst delete mode 100644 doc/users/next_whats_new/freethreading.rst delete mode 100644 doc/users/next_whats_new/histogram_vectorized_parameters.rst delete mode 100644 doc/users/next_whats_new/increased_figure_limits.rst delete mode 100644 doc/users/next_whats_new/inset_indicator.rst delete mode 100644 doc/users/next_whats_new/mouse_rotation.rst delete mode 100644 doc/users/next_whats_new/mpl_toolkit_colorbar_pad.rst delete mode 100644 doc/users/next_whats_new/pass_pandasDataFrame_into_table.rst delete mode 100644 doc/users/next_whats_new/subfigures_change_order.rst delete mode 100644 doc/users/next_whats_new/svg_id_rc.rst delete mode 100644 doc/users/next_whats_new/update_features.rst delete mode 100644 doc/users/next_whats_new/violinplot_orientation.rst create mode 100644 doc/users/prev_whats_new/whats_new_3.10.0.rst diff --git a/SECURITY.md b/SECURITY.md index ce022ca60a0f..4400a4501b51 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -8,14 +8,13 @@ versions. | Version | Supported | | ------- | ------------------ | +| 3.10.x | :white_check_mark: | | 3.9.x | :white_check_mark: | -| 3.8.x | :white_check_mark: | +| 3.8.x | :x: | | 3.7.x | :x: | | 3.6.x | :x: | | 3.5.x | :x: | -| 3.4.x | :x: | -| 3.3.x | :x: | -| < 3.3 | :x: | +| < 3.5 | :x: | ## Reporting a Vulnerability diff --git a/doc/_static/switcher.json b/doc/_static/switcher.json index 5a48ec138f4d..27451fd05657 100644 --- a/doc/_static/switcher.json +++ b/doc/_static/switcher.json @@ -1,15 +1,20 @@ [ { - "name": "3.9 (stable)", - "version": "3.9.2", + "name": "3.10 (stable)", + "version": "3.10.0", "url": "https://matplotlib.org/stable/", "preferred": true }, { - "name": "3.10 (dev)", + "name": "3.11 (dev)", "version": "dev", "url": "https://matplotlib.org/devdocs/" }, + { + "name": "3.9", + "version": "3.9.3", + "url": "https://matplotlib.org/3.9.4/" + }, { "name": "3.8", "version": "3.8.4", diff --git a/doc/api/next_api_changes/behavior/26000-t.rst b/doc/api/next_api_changes/behavior/26000-t.rst deleted file mode 100644 index 054feb0887e6..000000000000 --- a/doc/api/next_api_changes/behavior/26000-t.rst +++ /dev/null @@ -1,5 +0,0 @@ -onselect argument to selector widgets made optional -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -The *onselect* argument to `.EllipseSelector`, `.LassoSelector`, `.PolygonSelector`, and -`.RectangleSelector` is no longer required. diff --git a/doc/api/next_api_changes/behavior/27744-FM.rst b/doc/api/next_api_changes/behavior/27744-FM.rst deleted file mode 100644 index ae0d86336f81..000000000000 --- a/doc/api/next_api_changes/behavior/27744-FM.rst +++ /dev/null @@ -1,10 +0,0 @@ -``NavigationToolbar2.save_figure`` now returns filepath of saved figure -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -``NavigationToolbar2.save_figure`` function may return the filename of the saved figure. - -If a backend implements this functionality it should return `None` -in the case where no figure is actually saved (because the user closed the dialog without saving). - -If the backend does not or can not implement this functionality (currently the Gtk4 backends -and webagg backends do not) this method will return ``NavigationToolbar2.UNKNOWN_SAVED_STATUS``. diff --git a/doc/api/next_api_changes/behavior/27833-JA.rst b/doc/api/next_api_changes/behavior/27833-JA.rst deleted file mode 100644 index 59323f56108f..000000000000 --- a/doc/api/next_api_changes/behavior/27833-JA.rst +++ /dev/null @@ -1,8 +0,0 @@ -SVG output: improved reproducibility -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -Some SVG-format plots `produced different output on each render `__, even with a static ``svg.hashsalt`` value configured. - -The problem was a non-deterministic ID-generation scheme for clip paths; the fix introduces a repeatable, monotonically increasing integer ID scheme as a replacement. - -Provided that plots add clip paths themselves in deterministic order, this enables repeatable (a.k.a. reproducible, deterministic) SVG output. diff --git a/doc/api/next_api_changes/behavior/27891-ES.rst b/doc/api/next_api_changes/behavior/27891-ES.rst deleted file mode 100644 index f60b4b320a44..000000000000 --- a/doc/api/next_api_changes/behavior/27891-ES.rst +++ /dev/null @@ -1,5 +0,0 @@ -ft2font classes are now final -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -The ft2font classes `.ft2font.FT2Font`, and `.ft2font.FT2Image` are now final -and can no longer be subclassed. diff --git a/doc/api/next_api_changes/behavior/27996-REC.rst b/doc/api/next_api_changes/behavior/27996-REC.rst deleted file mode 100644 index fe81a34073b8..000000000000 --- a/doc/api/next_api_changes/behavior/27996-REC.rst +++ /dev/null @@ -1,8 +0,0 @@ -``InsetIndicator`` artist -~~~~~~~~~~~~~~~~~~~~~~~~~ - -`~.Axes.indicate_inset` and `~.Axes.indicate_inset_zoom` now return an instance -of `~matplotlib.inset.InsetIndicator`. Use the -`~matplotlib.inset.InsetIndicator.rectangle` and -`~matplotlib.inset.InsetIndicator.connectors` properties of this artist to -access the objects that were previously returned directly. diff --git a/doc/api/next_api_changes/behavior/28061-JMK.rst b/doc/api/next_api_changes/behavior/28061-JMK.rst deleted file mode 100644 index e3ffb783b394..000000000000 --- a/doc/api/next_api_changes/behavior/28061-JMK.rst +++ /dev/null @@ -1,23 +0,0 @@ -``imshow`` *interpolation_stage* default changed to 'auto' -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -The *interpolation_stage* parameter of `~.Axes.imshow` has a new default -value 'auto'. For images that are up-sampled less than a factor of -three or down-sampled, image interpolation will occur in 'rgba' space. For images -that are up-sampled by a factor of 3 or more, then image interpolation occurs -in 'data' space. - -The previous default was 'data', so down-sampled images may change subtly with -the new default. However, the new default also avoids floating point artifacts -at sharp boundaries in a colormap when down-sampling. - -The previous behavior can achieved by setting the *interpolation_stage* parameter -or :rc:`image.interpolation_stage` to 'data'. - -imshow default *interpolation* changed to 'auto' -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -The *interpolation* parameter of `~.Axes.imshow` has a new default -value 'auto', changed from 'antialiased', for consistency with *interpolation_stage* -and because the interpolation is only anti-aliasing during down-sampling. Passing -'antialiased' still works, and behaves exactly the same as 'auto', but is discouraged. diff --git a/doc/api/next_api_changes/behavior/28156-AL.rst b/doc/api/next_api_changes/behavior/28156-AL.rst deleted file mode 100644 index af9c2b142261..000000000000 --- a/doc/api/next_api_changes/behavior/28156-AL.rst +++ /dev/null @@ -1,12 +0,0 @@ -dark_background and fivethirtyeight styles no longer set ``savefig.facecolor`` and ``savefig.edgecolor`` -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -When using these styles, :rc:`savefig.facecolor` and :rc:`savefig.edgecolor` -now inherit the global default value of "auto", which means that the actual -figure colors will be used. Previously, these rcParams were set to the same -values as :rc:`figure.facecolor` and :rc:`figure.edgecolor`, i.e. a saved -figure would always use the theme colors even if the user manually overrode -them; this is no longer the case. - -This change should have no impact for users that do not manually set the figure -face and edge colors. diff --git a/doc/api/next_api_changes/behavior/28177-REC.rst b/doc/api/next_api_changes/behavior/28177-REC.rst deleted file mode 100644 index d7ea8ec0e947..000000000000 --- a/doc/api/next_api_changes/behavior/28177-REC.rst +++ /dev/null @@ -1,7 +0,0 @@ -(Sub)Figure.get_figure -~~~~~~~~~~~~~~~~~~~~~~ - -...in future will by default return the direct parent figure, which may be a SubFigure. -This will make the default behavior consistent with the -`~matplotlib.artist.Artist.get_figure` method of other artists. To control the -behavior, use the newly introduced *root* parameter. diff --git a/doc/api/next_api_changes/behavior/28354-YN.rst b/doc/api/next_api_changes/behavior/28354-YN.rst deleted file mode 100644 index 69c25575c516..000000000000 --- a/doc/api/next_api_changes/behavior/28354-YN.rst +++ /dev/null @@ -1,4 +0,0 @@ -Add zorder option in QuiverKey -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -``zorder`` can be used as a keyword argument to `.QuiverKey`. Previously, -that parameter did not have any effect because the zorder was hard coded. diff --git a/doc/api/next_api_changes/behavior/28363-TS.rst b/doc/api/next_api_changes/behavior/28363-TS.rst deleted file mode 100644 index 2242f3929e04..000000000000 --- a/doc/api/next_api_changes/behavior/28363-TS.rst +++ /dev/null @@ -1,6 +0,0 @@ -Subfigures -~~~~~~~~~~ - -`.Figure.subfigures` are now added in row-major order to be consistent with -`.Figure.subplots`. The return value of `~.Figure.subfigures` is not changed, -but the order of ``fig.subfigs`` is. diff --git a/doc/api/next_api_changes/behavior/28375-MP.rst b/doc/api/next_api_changes/behavior/28375-MP.rst deleted file mode 100644 index 75d7f7cf5030..000000000000 --- a/doc/api/next_api_changes/behavior/28375-MP.rst +++ /dev/null @@ -1,5 +0,0 @@ -``transforms.AffineDeltaTransform`` updates correctly on axis limit changes -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -Before this change, transform sub-graphs with ``AffineDeltaTransform`` did not update correctly. -This PR ensures that changes to the child transform are passed through correctly. diff --git a/doc/api/next_api_changes/behavior/28501-OV.rst b/doc/api/next_api_changes/behavior/28501-OV.rst deleted file mode 100644 index cc816e55f696..000000000000 --- a/doc/api/next_api_changes/behavior/28501-OV.rst +++ /dev/null @@ -1,5 +0,0 @@ -The offset string associated with ConciseDateFormatter will now invert when the axis is inverted -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -Previously, when the axis was inverted, the offset string associated with ConciseDateFormatter would not change, -so the offset string indicated the axis was oriented in the wrong direction. Now, when the axis is inverted, the offset -string is oriented correctly. diff --git a/doc/api/next_api_changes/behavior/28734-REC.rst b/doc/api/next_api_changes/behavior/28734-REC.rst deleted file mode 100644 index 825922f4fafb..000000000000 --- a/doc/api/next_api_changes/behavior/28734-REC.rst +++ /dev/null @@ -1,7 +0,0 @@ -``suptitle`` in compressed layout -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -Compressed layout now automatically positions the `~.Figure.suptitle` just -above the top row of axes. To keep this title in its previous position, -either pass ``in_layout=False`` or explicitly set ``y=0.98`` in the -`~.Figure.suptitle` call. diff --git a/doc/api/next_api_changes/deprecations/27385-SS.rst b/doc/api/next_api_changes/deprecations/27385-SS.rst deleted file mode 100644 index b388ce22eb2b..000000000000 --- a/doc/api/next_api_changes/deprecations/27385-SS.rst +++ /dev/null @@ -1,3 +0,0 @@ -``proj3d.proj_transform_clip`` -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -... is deprecated with no replacement. diff --git a/doc/api/next_api_changes/deprecations/27786-TH.rst b/doc/api/next_api_changes/deprecations/27786-TH.rst deleted file mode 100644 index 6b66e0dba963..000000000000 --- a/doc/api/next_api_changes/deprecations/27786-TH.rst +++ /dev/null @@ -1,7 +0,0 @@ -Positional parameters in plotting functions -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -Many plotting functions will restrict positional arguments to the first few parameters -in the future. All further configuration parameters will have to be passed as keyword -arguments. This is to enforce better code and and allow for future changes with reduced -risk of breaking existing code. diff --git a/doc/api/next_api_changes/deprecations/28007-TH.rst b/doc/api/next_api_changes/deprecations/28007-TH.rst deleted file mode 100644 index cfaa329dd9e0..000000000000 --- a/doc/api/next_api_changes/deprecations/28007-TH.rst +++ /dev/null @@ -1,6 +0,0 @@ -Changing ``Figure.number`` -~~~~~~~~~~~~~~~~~~~~~~~~~~ - -Changing ``Figure.number`` is deprecated. This value is used by `.pyplot` -to identify figures. It must stay in sync with the pyplot internal state -and is not intended to be modified by the user. diff --git a/doc/api/next_api_changes/deprecations/28048-PR.rst b/doc/api/next_api_changes/deprecations/28048-PR.rst deleted file mode 100644 index 4e90a3aced19..000000000000 --- a/doc/api/next_api_changes/deprecations/28048-PR.rst +++ /dev/null @@ -1,4 +0,0 @@ -``PdfFile.hatchPatterns`` -~~~~~~~~~~~~~~~~~~~~~~~~~ - -... is deprecated. diff --git a/doc/api/next_api_changes/deprecations/28177-REC.rst b/doc/api/next_api_changes/deprecations/28177-REC.rst deleted file mode 100644 index a3e630630aeb..000000000000 --- a/doc/api/next_api_changes/deprecations/28177-REC.rst +++ /dev/null @@ -1,5 +0,0 @@ -(Sub)Figure.set_figure -~~~~~~~~~~~~~~~~~~~~~~ - -...is deprecated and in future will always raise an exception. The parent and -root figures of a (Sub)Figure are set at instantiation and cannot be changed. diff --git a/doc/api/next_api_changes/deprecations/28201-AT.rst b/doc/api/next_api_changes/deprecations/28201-AT.rst deleted file mode 100644 index 56205315a7c1..000000000000 --- a/doc/api/next_api_changes/deprecations/28201-AT.rst +++ /dev/null @@ -1,3 +0,0 @@ -``Poly3DCollection.get_vector`` -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -... is deprecated with no replacement. diff --git a/doc/api/next_api_changes/deprecations/28670-TAC.rst b/doc/api/next_api_changes/deprecations/28670-TAC.rst deleted file mode 100644 index e970abf69d54..000000000000 --- a/doc/api/next_api_changes/deprecations/28670-TAC.rst +++ /dev/null @@ -1,6 +0,0 @@ -Deprecated ``register`` on ``matplotlib.patches._Styles`` and subclasses -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -This class method is never used internally. Due to the internal check in the -method it only accepts subclasses of a private baseclass embedded in the host -class which makes it unlikely that it has been used externally. diff --git a/doc/api/next_api_changes/deprecations/28728-TH.rst b/doc/api/next_api_changes/deprecations/28728-TH.rst deleted file mode 100644 index 56d5a80b439c..000000000000 --- a/doc/api/next_api_changes/deprecations/28728-TH.rst +++ /dev/null @@ -1,10 +0,0 @@ -matplotlib.validate_backend -~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -...is deprecated. Please use `matplotlib.rcsetup.validate_backend` instead. - - -matplotlib.sanitize_sequence -~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -...is deprecated. Please use `matplotlib.cbook.sanitize_sequence` instead. diff --git a/doc/api/next_api_changes/deprecations/28842-ES.rst b/doc/api/next_api_changes/deprecations/28842-ES.rst deleted file mode 100644 index d88d3f7b9538..000000000000 --- a/doc/api/next_api_changes/deprecations/28842-ES.rst +++ /dev/null @@ -1,55 +0,0 @@ -ft2font module-level constants replaced by enums -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -The `.ft2font`-level constants have been converted to `enum` classes, and all API using -them now take/return the new types. - -The following constants are now part of `.ft2font.Kerning` (without the ``KERNING_`` -prefix): - -- ``KERNING_DEFAULT`` -- ``KERNING_UNFITTED`` -- ``KERNING_UNSCALED`` - -The following constants are now part of `.ft2font.LoadFlags` (without the ``LOAD_`` -prefix): - -- ``LOAD_DEFAULT`` -- ``LOAD_NO_SCALE`` -- ``LOAD_NO_HINTING`` -- ``LOAD_RENDER`` -- ``LOAD_NO_BITMAP`` -- ``LOAD_VERTICAL_LAYOUT`` -- ``LOAD_FORCE_AUTOHINT`` -- ``LOAD_CROP_BITMAP`` -- ``LOAD_PEDANTIC`` -- ``LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH`` -- ``LOAD_NO_RECURSE`` -- ``LOAD_IGNORE_TRANSFORM`` -- ``LOAD_MONOCHROME`` -- ``LOAD_LINEAR_DESIGN`` -- ``LOAD_NO_AUTOHINT`` -- ``LOAD_TARGET_NORMAL`` -- ``LOAD_TARGET_LIGHT`` -- ``LOAD_TARGET_MONO`` -- ``LOAD_TARGET_LCD`` -- ``LOAD_TARGET_LCD_V`` - -The following constants are now part of `.ft2font.FaceFlags`: - -- ``EXTERNAL_STREAM`` -- ``FAST_GLYPHS`` -- ``FIXED_SIZES`` -- ``FIXED_WIDTH`` -- ``GLYPH_NAMES`` -- ``HORIZONTAL`` -- ``KERNING`` -- ``MULTIPLE_MASTERS`` -- ``SCALABLE`` -- ``SFNT`` -- ``VERTICAL`` - -The following constants are now part of `.ft2font.StyleFlags`: - -- ``ITALIC`` -- ``BOLD`` diff --git a/doc/api/next_api_changes/deprecations/28843-TH.rst b/doc/api/next_api_changes/deprecations/28843-TH.rst deleted file mode 100644 index 25dc91be3ccc..000000000000 --- a/doc/api/next_api_changes/deprecations/28843-TH.rst +++ /dev/null @@ -1,9 +0,0 @@ -FontProperties initialization -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -`.FontProperties` initialization is limited to the two call patterns: - -- single positional parameter, interpreted as fontconfig pattern -- only keyword parameters for setting individual properties - -All other previously supported call patterns are deprecated. diff --git a/doc/api/next_api_changes/deprecations/28933-AL.rst b/doc/api/next_api_changes/deprecations/28933-AL.rst deleted file mode 100644 index b551c124b4e0..000000000000 --- a/doc/api/next_api_changes/deprecations/28933-AL.rst +++ /dev/null @@ -1,5 +0,0 @@ -``AxLine`` ``xy1`` and ``xy2`` setters -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -These setters now each take a single argument, ``xy1`` or ``xy2`` as a tuple. -The old form, where ``x`` and ``y`` were passed as separate arguments, is -deprecated. diff --git a/doc/api/next_api_changes/deprecations/28946-TH.rst b/doc/api/next_api_changes/deprecations/28946-TH.rst deleted file mode 100644 index 6a2f09108686..000000000000 --- a/doc/api/next_api_changes/deprecations/28946-TH.rst +++ /dev/null @@ -1,6 +0,0 @@ -Calling ``pyplot.polar()`` with an existing non-polar Axes -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -This currently plots the data into the non-polar Axes, ignoring -the "polar" intention. This usage scenario is deprecated and -will raise an error in the future. diff --git a/doc/api/next_api_changes/deprecations/28967-ES.rst b/doc/api/next_api_changes/deprecations/28967-ES.rst deleted file mode 100644 index 8bb238def943..000000000000 --- a/doc/api/next_api_changes/deprecations/28967-ES.rst +++ /dev/null @@ -1,12 +0,0 @@ -Passing floating-point values to ``RendererAgg.draw_text_image`` -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -Any floating-point values passed to the *x* and *y* parameters were truncated to integers -silently. This behaviour is now deprecated, and only `int` values should be used. - -Passing floating-point values to ``FT2Image`` -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -Any floating-point values passed to the `.FT2Image` constructor, or the *x0*, *y0*, *x1*, -and *y1* parameters of `.FT2Image.draw_rect_filled` were truncated to integers silently. -This behaviour is now deprecated, and only `int` values should be used. diff --git a/doc/api/next_api_changes/development/28289-ES.rst b/doc/api/next_api_changes/development/28289-ES.rst deleted file mode 100644 index f891c63a64bf..000000000000 --- a/doc/api/next_api_changes/development/28289-ES.rst +++ /dev/null @@ -1,7 +0,0 @@ -Documentation-specific custom Sphinx roles are now semi-public -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -For third-party packages that derive types from Matplotlib, our use of custom roles may -prevent Sphinx from building their docs. These custom Sphinx roles are now public solely -for the purposes of use within projects that derive from Matplotlib types. See -:mod:`matplotlib.sphinxext.roles` for details. diff --git a/doc/api/next_api_changes/removals/20866-JKS.rst b/doc/api/next_api_changes/removals/20866-JKS.rst deleted file mode 100644 index 14dbe039a4cf..000000000000 --- a/doc/api/next_api_changes/removals/20866-JKS.rst +++ /dev/null @@ -1,7 +0,0 @@ -ttconv removed -~~~~~~~~~~~~~~ - -The ``matplotlib._ttconv`` extension has been removed. Most of its -functionaliy was already replaced by other code, and the only thing left -was embedding TTF fonts in PostScript in Type 42 format. This is now -done in the PS backend using the FontTools library. diff --git a/doc/api/next_api_changes/removals/27218-TAC.rst b/doc/api/next_api_changes/removals/27218-TAC.rst deleted file mode 100644 index ac69e8a96a26..000000000000 --- a/doc/api/next_api_changes/removals/27218-TAC.rst +++ /dev/null @@ -1,7 +0,0 @@ -Remove hard reference to ``lastevent`` in ``LocationEvent`` -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - - -This was previously used to detect exiting from axes, however the hard -reference would keep closed `.Figure` objects and their children alive longer -than expected. diff --git a/doc/api/next_api_changes/removals/27891-ES.rst b/doc/api/next_api_changes/removals/27891-ES.rst deleted file mode 100644 index cb658e9bc671..000000000000 --- a/doc/api/next_api_changes/removals/27891-ES.rst +++ /dev/null @@ -1,4 +0,0 @@ -``ft2font.FT2Image.draw_rect`` and ``ft2font.FT2Font.get_xys`` -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -... have been removed as they are unused. diff --git a/doc/api/next_api_changes/removals/28183-OG.rst b/doc/api/next_api_changes/removals/28183-OG.rst deleted file mode 100644 index 55745e47809a..000000000000 --- a/doc/api/next_api_changes/removals/28183-OG.rst +++ /dev/null @@ -1,62 +0,0 @@ -``Tick.set_label``, ``Tick.set_label1`` and ``Tick.set_label2`` -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -... are removed. Calling these methods from third-party code usually had no -effect, as the labels are overwritten at draw time by the tick formatter. - - -Functions in ``mpl_toolkits.mplot3d.proj3d`` -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -The function ``transform`` is just an alias for ``proj_transform``, -use the latter instead. - -The following functions were either unused (so no longer required in Matplotlib) -or considered private. - -* ``ortho_transformation`` -* ``persp_transformation`` -* ``proj_points`` -* ``proj_trans_points`` -* ``rot_x`` -* ``rotation_about_vector`` -* ``view_transformation`` - - -Arguments other than ``renderer`` to ``get_tightbbox`` -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -... are keyword-only arguments. This is for consistency and that -different classes have different additional arguments. - - -Method parameters renamed to match base classes -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -The only parameter of ``transform_affine`` and ``transform_non_affine`` in ``Transform`` subclasses is renamed -to *values*. - -The *points* parameter of ``transforms.IdentityTransform.transform`` is renamed to *values*. - -The *trans* parameter of ``table.Cell.set_transform`` is renamed to *t* consistently with -`.Artist.set_transform`. - -The *clippath* parameters of ``axis.Axis.set_clip_path`` and ``axis.Tick.set_clip_path`` are -renamed to *path* consistently with `.Artist.set_clip_path`. - -The *s* parameter of ``images.NonUniformImage.set_filternorm`` is renamed to *filternorm* -consistently with ``_ImageBase.set_filternorm``. - -The *s* parameter of ``images.NonUniformImage.set_filterrad`` is renamed to *filterrad* -consistently with ``_ImageBase.set_filterrad``. - -The only parameter of ``Annotation.contains`` and ``Legend.contains`` is renamed to *mouseevent* -consistently with `.Artist.contains`. - -Method parameters renamed -~~~~~~~~~~~~~~~~~~~~~~~~~ - -The *p* parameter of ``BboxBase.padded`` is renamed to *w_pad*, consistently with the other parameter, *h_pad* - -*numdecs* parameter and attribute of ``LogLocator`` -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -... are removed without replacement, because they had no effect. diff --git a/doc/api/next_api_changes/removals/28492-GML.rst b/doc/api/next_api_changes/removals/28492-GML.rst deleted file mode 100644 index 953b01b9489f..000000000000 --- a/doc/api/next_api_changes/removals/28492-GML.rst +++ /dev/null @@ -1,9 +0,0 @@ -The ``PolyQuadMesh`` class requires full 2D arrays of values -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -Previously, if a masked array was input, the list of polygons within the collection -would shrink to the size of valid polygons and users were required to keep track of -which polygons were drawn and call ``set_array()`` with the smaller "compressed" -array size. Passing the "compressed" and flattened array values will no longer -work and the full 2D array of values (including the mask) should be passed -to `.PolyQuadMesh.set_array`. diff --git a/doc/api/next_api_changes/removals/28767-REC.rst b/doc/api/next_api_changes/removals/28767-REC.rst deleted file mode 100644 index a06d78245761..000000000000 --- a/doc/api/next_api_changes/removals/28767-REC.rst +++ /dev/null @@ -1,31 +0,0 @@ -``ContourSet.collections`` -~~~~~~~~~~~~~~~~~~~~~~~~~~ - -... has been removed. `~.ContourSet` is now implemented as a single -`~.Collection` of paths, each path corresponding to a contour level, possibly -including multiple unconnected components. - -``ContourSet.antialiased`` -~~~~~~~~~~~~~~~~~~~~~~~~~~ - -... has been removed. Use `~.Collection.get_antialiased` or -`~.Collection.set_antialiased` instead. Note that `~.Collection.get_antialiased` -returns an array. - -``tcolors`` and ``tlinewidths`` attributes of ``ContourSet`` -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -... have been removed. Use `~.Collection.get_facecolor`, `~.Collection.get_edgecolor` -or `~.Collection.get_linewidths` instead. - - -``calc_label_rot_and_inline`` method of ``ContourLabeler`` -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -... has been removed without replacement. - - -``add_label_clabeltext`` method of ``ContourLabeler`` -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -... has been removed. Use `~.ContourLabeler.add_label` instead. diff --git a/doc/api/prev_api_changes/api_changes_3.10.0.rst b/doc/api/prev_api_changes/api_changes_3.10.0.rst new file mode 100644 index 000000000000..83bde66213f3 --- /dev/null +++ b/doc/api/prev_api_changes/api_changes_3.10.0.rst @@ -0,0 +1,14 @@ +API Changes for 3.10.0 +====================== + +.. contents:: + :local: + :depth: 1 + +.. include:: /api/prev_api_changes/api_changes_3.10.0/behaviour.rst + +.. include:: /api/prev_api_changes/api_changes_3.10.0/deprecations.rst + +.. include:: /api/prev_api_changes/api_changes_3.10.0/removals.rst + +.. include:: /api/prev_api_changes/api_changes_3.10.0/development.rst diff --git a/doc/api/prev_api_changes/api_changes_3.10.0/behavior.rst b/doc/api/prev_api_changes/api_changes_3.10.0/behavior.rst new file mode 100644 index 000000000000..87da6568a860 --- /dev/null +++ b/doc/api/prev_api_changes/api_changes_3.10.0/behavior.rst @@ -0,0 +1,118 @@ +onselect argument to selector widgets made optional +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +The *onselect* argument to `.EllipseSelector`, `.LassoSelector`, `.PolygonSelector`, and +`.RectangleSelector` is no longer required. + +``NavigationToolbar2.save_figure`` now returns filepath of saved figure +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +``NavigationToolbar2.save_figure`` function may return the filename of the saved figure. + +If a backend implements this functionality it should return `None` +in the case where no figure is actually saved (because the user closed the dialog without saving). + +If the backend does not or can not implement this functionality (currently the Gtk4 backends +and webagg backends do not) this method will return ``NavigationToolbar2.UNKNOWN_SAVED_STATUS``. + +SVG output: improved reproducibility +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Some SVG-format plots `produced different output on each render `__, even with a static ``svg.hashsalt`` value configured. + +The problem was a non-deterministic ID-generation scheme for clip paths; the fix introduces a repeatable, monotonically increasing integer ID scheme as a replacement. + +Provided that plots add clip paths themselves in deterministic order, this enables repeatable (a.k.a. reproducible, deterministic) SVG output. + +ft2font classes are now final +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +The ft2font classes `.ft2font.FT2Font`, and `.ft2font.FT2Image` are now final +and can no longer be subclassed. + +``InsetIndicator`` artist +~~~~~~~~~~~~~~~~~~~~~~~~~ + +`~.Axes.indicate_inset` and `~.Axes.indicate_inset_zoom` now return an instance +of `~matplotlib.inset.InsetIndicator`. Use the +`~matplotlib.inset.InsetIndicator.rectangle` and +`~matplotlib.inset.InsetIndicator.connectors` properties of this artist to +access the objects that were previously returned directly. + +``imshow`` *interpolation_stage* default changed to 'auto' +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +The *interpolation_stage* parameter of `~.Axes.imshow` has a new default +value 'auto'. For images that are up-sampled less than a factor of +three or down-sampled, image interpolation will occur in 'rgba' space. For images +that are up-sampled by a factor of 3 or more, then image interpolation occurs +in 'data' space. + +The previous default was 'data', so down-sampled images may change subtly with +the new default. However, the new default also avoids floating point artifacts +at sharp boundaries in a colormap when down-sampling. + +The previous behavior can achieved by setting the *interpolation_stage* parameter +or :rc:`image.interpolation_stage` to 'data'. + +imshow default *interpolation* changed to 'auto' +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +The *interpolation* parameter of `~.Axes.imshow` has a new default +value 'auto', changed from 'antialiased', for consistency with *interpolation_stage* +and because the interpolation is only anti-aliasing during down-sampling. Passing +'antialiased' still works, and behaves exactly the same as 'auto', but is discouraged. + +dark_background and fivethirtyeight styles no longer set ``savefig.facecolor`` and ``savefig.edgecolor`` +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +When using these styles, :rc:`savefig.facecolor` and :rc:`savefig.edgecolor` +now inherit the global default value of "auto", which means that the actual +figure colors will be used. Previously, these rcParams were set to the same +values as :rc:`figure.facecolor` and :rc:`figure.edgecolor`, i.e. a saved +figure would always use the theme colors even if the user manually overrode +them; this is no longer the case. + +This change should have no impact for users that do not manually set the figure +face and edge colors. + +Add zorder option in QuiverKey +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +``zorder`` can be used as a keyword argument to `.QuiverKey`. Previously, +that parameter did not have any effect because the zorder was hard coded. + +Subfigures +~~~~~~~~~~ + +`.Figure.subfigures` are now added in row-major order to be consistent with +`.Figure.subplots`. The return value of `~.Figure.subfigures` is not changed, +but the order of ``fig.subfigs`` is. + +(Sub)Figure.get_figure +~~~~~~~~~~~~~~~~~~~~~~ + +...in future will by default return the direct parent figure, which may be a SubFigure. +This will make the default behavior consistent with the +`~matplotlib.artist.Artist.get_figure` method of other artists. To control the +behavior, use the newly introduced *root* parameter. + + +``transforms.AffineDeltaTransform`` updates correctly on axis limit changes +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Before this change, transform sub-graphs with ``AffineDeltaTransform`` did not update correctly. +This PR ensures that changes to the child transform are passed through correctly. + +The offset string associated with ConciseDateFormatter will now invert when the axis is inverted +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +Previously, when the axis was inverted, the offset string associated with ConciseDateFormatter would not change, +so the offset string indicated the axis was oriented in the wrong direction. Now, when the axis is inverted, the offset +string is oriented correctly. + +``suptitle`` in compressed layout +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Compressed layout now automatically positions the `~.Figure.suptitle` just +above the top row of axes. To keep this title in its previous position, +either pass ``in_layout=False`` or explicitly set ``y=0.98`` in the +`~.Figure.suptitle` call. diff --git a/doc/api/prev_api_changes/api_changes_3.10.0/deprecations.rst b/doc/api/prev_api_changes/api_changes_3.10.0/deprecations.rst new file mode 100644 index 000000000000..ad344b37d069 --- /dev/null +++ b/doc/api/prev_api_changes/api_changes_3.10.0/deprecations.rst @@ -0,0 +1,164 @@ +Positional parameters in plotting functions +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Many plotting functions will restrict positional arguments to the first few parameters +in the future. All further configuration parameters will have to be passed as keyword +arguments. This is to enforce better code and and allow for future changes with reduced +risk of breaking existing code. +Changing ``Figure.number`` +~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Changing ``Figure.number`` is deprecated. This value is used by `.pyplot` +to identify figures. It must stay in sync with the pyplot internal state +and is not intended to be modified by the user. + +``PdfFile.hatchPatterns`` +~~~~~~~~~~~~~~~~~~~~~~~~~ + +... is deprecated. + +(Sub)Figure.set_figure +~~~~~~~~~~~~~~~~~~~~~~ + +...is deprecated and in future will always raise an exception. The parent and +root figures of a (Sub)Figure are set at instantiation and cannot be changed. + +``Poly3DCollection.get_vector`` +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +... is deprecated with no replacement. + +Deprecated ``register`` on ``matplotlib.patches._Styles`` and subclasses +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +This class method is never used internally. Due to the internal check in the +method it only accepts subclasses of a private baseclass embedded in the host +class which makes it unlikely that it has been used externally. + +matplotlib.validate_backend +~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +...is deprecated. Please use `matplotlib.rcsetup.validate_backend` instead. + + +matplotlib.sanitize_sequence +~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +...is deprecated. Please use `matplotlib.cbook.sanitize_sequence` instead. + +ft2font module-level constants replaced by enums +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +The `.ft2font`-level constants have been converted to `enum` classes, and all API using +them now take/return the new types. + +The following constants are now part of `.ft2font.Kerning` (without the ``KERNING_`` +prefix): + +- ``KERNING_DEFAULT`` +- ``KERNING_UNFITTED`` +- ``KERNING_UNSCALED`` + +The following constants are now part of `.ft2font.LoadFlags` (without the ``LOAD_`` +prefix): + +- ``LOAD_DEFAULT`` +- ``LOAD_NO_SCALE`` +- ``LOAD_NO_HINTING`` +- ``LOAD_RENDER`` +- ``LOAD_NO_BITMAP`` +- ``LOAD_VERTICAL_LAYOUT`` +- ``LOAD_FORCE_AUTOHINT`` +- ``LOAD_CROP_BITMAP`` +- ``LOAD_PEDANTIC`` +- ``LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH`` +- ``LOAD_NO_RECURSE`` +- ``LOAD_IGNORE_TRANSFORM`` +- ``LOAD_MONOCHROME`` +- ``LOAD_LINEAR_DESIGN`` +- ``LOAD_NO_AUTOHINT`` +- ``LOAD_TARGET_NORMAL`` +- ``LOAD_TARGET_LIGHT`` +- ``LOAD_TARGET_MONO`` +- ``LOAD_TARGET_LCD`` +- ``LOAD_TARGET_LCD_V`` + +The following constants are now part of `.ft2font.FaceFlags`: + +- ``EXTERNAL_STREAM`` +- ``FAST_GLYPHS`` +- ``FIXED_SIZES`` +- ``FIXED_WIDTH`` +- ``GLYPH_NAMES`` +- ``HORIZONTAL`` +- ``KERNING`` +- ``MULTIPLE_MASTERS`` +- ``SCALABLE`` +- ``SFNT`` +- ``VERTICAL`` + +The following constants are now part of `.ft2font.StyleFlags`: + +- ``ITALIC`` +- ``BOLD`` + +FontProperties initialization +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +`.FontProperties` initialization is limited to the two call patterns: + +- single positional parameter, interpreted as fontconfig pattern +- only keyword parameters for setting individual properties + +All other previously supported call patterns are deprecated. + +``AxLine`` ``xy1`` and ``xy2`` setters +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +These setters now each take a single argument, ``xy1`` or ``xy2`` as a tuple. +The old form, where ``x`` and ``y`` were passed as separate arguments, is +deprecated. + +Calling ``pyplot.polar()`` with an existing non-polar Axes +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +This currently plots the data into the non-polar Axes, ignoring +the "polar" intention. This usage scenario is deprecated and +will raise an error in the future. + +Passing floating-point values to ``RendererAgg.draw_text_image`` +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Any floating-point values passed to the *x* and *y* parameters were truncated to integers +silently. This behaviour is now deprecated, and only `int` values should be used. + +Passing floating-point values to ``FT2Image`` +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Any floating-point values passed to the `.FT2Image` constructor, or the *x0*, *y0*, *x1*, +and *y1* parameters of `.FT2Image.draw_rect_filled` were truncated to integers silently. +This behaviour is now deprecated, and only `int` values should be used. + +``boxplot`` and ``bxp`` *vert* parameter, and ``rcParams["boxplot.vertical"]`` +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +The parameter *vert: bool* has been deprecated on `~.Axes.boxplot` and +`~.Axes.bxp`. It is replaced by *orientation: {"vertical", "horizontal"}* +for API consistency. + +``rcParams["boxplot.vertical"]``, which controlled the orientation of ``boxplot``, +is deprecated without replacement. + +This deprecation is currently marked as pending and will be fully deprecated in Matplotlib 3.11. + +``violinplot`` and ``violin`` *vert* parameter +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +The parameter *vert: bool* has been deprecated on `~.Axes.violinplot` and +`~.Axes.violin`. +It will be replaced by *orientation: {"vertical", "horizontal"}* for API +consistency. + +This deprecation is currently marked as pending and will be fully deprecated in Matplotlib 3.11. + +``proj3d.proj_transform_clip`` +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +... is deprecated with no replacement. diff --git a/doc/api/next_api_changes/development/28503-ES.rst b/doc/api/prev_api_changes/api_changes_3.10.0/development.rst similarity index 56% rename from doc/api/next_api_changes/development/28503-ES.rst rename to doc/api/prev_api_changes/api_changes_3.10.0/development.rst index e9b109cb8515..58ece9877912 100644 --- a/doc/api/next_api_changes/development/28503-ES.rst +++ b/doc/api/prev_api_changes/api_changes_3.10.0/development.rst @@ -1,3 +1,11 @@ +Documentation-specific custom Sphinx roles are now semi-public +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +For third-party packages that derive types from Matplotlib, our use of custom roles may +prevent Sphinx from building their docs. These custom Sphinx roles are now public solely +for the purposes of use within projects that derive from Matplotlib types. See +:mod:`matplotlib.sphinxext.roles` for details. + Increase to minimum supported versions of dependencies ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/doc/api/next_api_changes/removals/28874-ES.rst b/doc/api/prev_api_changes/api_changes_3.10.0/removals.rst similarity index 58% rename from doc/api/next_api_changes/removals/28874-ES.rst rename to doc/api/prev_api_changes/api_changes_3.10.0/removals.rst index dbd8778dead1..e535123c7016 100644 --- a/doc/api/next_api_changes/removals/28874-ES.rst +++ b/doc/api/prev_api_changes/api_changes_3.10.0/removals.rst @@ -1,3 +1,126 @@ +ttconv removed +~~~~~~~~~~~~~~ + +The ``matplotlib._ttconv`` extension has been removed. Most of its +functionaliy was already replaced by other code, and the only thing left +was embedding TTF fonts in PostScript in Type 42 format. This is now +done in the PS backend using the FontTools library. + +Remove hard reference to ``lastevent`` in ``LocationEvent`` +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + +This was previously used to detect exiting from axes, however the hard +reference would keep closed `.Figure` objects and their children alive longer +than expected. + +``ft2font.FT2Image.draw_rect`` and ``ft2font.FT2Font.get_xys`` +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +... have been removed as they are unused. + +``Tick.set_label``, ``Tick.set_label1`` and ``Tick.set_label2`` +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +... are removed. Calling these methods from third-party code usually had no +effect, as the labels are overwritten at draw time by the tick formatter. + + +Functions in ``mpl_toolkits.mplot3d.proj3d`` +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +The function ``transform`` is just an alias for ``proj_transform``, +use the latter instead. + +The following functions were either unused (so no longer required in Matplotlib) +or considered private. + +* ``ortho_transformation`` +* ``persp_transformation`` +* ``proj_points`` +* ``proj_trans_points`` +* ``rot_x`` +* ``rotation_about_vector`` +* ``view_transformation`` + + +Arguments other than ``renderer`` to ``get_tightbbox`` +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +... are keyword-only arguments. This is for consistency and that +different classes have different additional arguments. + + +Method parameters renamed to match base classes +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +The only parameter of ``transform_affine`` and ``transform_non_affine`` in ``Transform`` subclasses is renamed +to *values*. + +The *points* parameter of ``transforms.IdentityTransform.transform`` is renamed to *values*. + +The *trans* parameter of ``table.Cell.set_transform`` is renamed to *t* consistently with +`.Artist.set_transform`. + +The *clippath* parameters of ``axis.Axis.set_clip_path`` and ``axis.Tick.set_clip_path`` are +renamed to *path* consistently with `.Artist.set_clip_path`. + +The *s* parameter of ``images.NonUniformImage.set_filternorm`` is renamed to *filternorm* +consistently with ``_ImageBase.set_filternorm``. + +The *s* parameter of ``images.NonUniformImage.set_filterrad`` is renamed to *filterrad* +consistently with ``_ImageBase.set_filterrad``. + +The only parameter of ``Annotation.contains`` and ``Legend.contains`` is renamed to *mouseevent* +consistently with `.Artist.contains`. + +Method parameters renamed +~~~~~~~~~~~~~~~~~~~~~~~~~ + +The *p* parameter of ``BboxBase.padded`` is renamed to *w_pad*, consistently with the other parameter, *h_pad* + +*numdecs* parameter and attribute of ``LogLocator`` +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +... are removed without replacement, because they had no effect. +The ``PolyQuadMesh`` class requires full 2D arrays of values +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Previously, if a masked array was input, the list of polygons within the collection +would shrink to the size of valid polygons and users were required to keep track of +which polygons were drawn and call ``set_array()`` with the smaller "compressed" +array size. Passing the "compressed" and flattened array values will no longer +work and the full 2D array of values (including the mask) should be passed +to `.PolyQuadMesh.set_array`. +``ContourSet.collections`` +~~~~~~~~~~~~~~~~~~~~~~~~~~ + +... has been removed. `~.ContourSet` is now implemented as a single +`~.Collection` of paths, each path corresponding to a contour level, possibly +including multiple unconnected components. + +``ContourSet.antialiased`` +~~~~~~~~~~~~~~~~~~~~~~~~~~ + +... has been removed. Use `~.Collection.get_antialiased` or +`~.Collection.set_antialiased` instead. Note that `~.Collection.get_antialiased` +returns an array. + +``tcolors`` and ``tlinewidths`` attributes of ``ContourSet`` +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +... have been removed. Use `~.Collection.get_facecolor`, `~.Collection.get_edgecolor` +or `~.Collection.get_linewidths` instead. + + +``calc_label_rot_and_inline`` method of ``ContourLabeler`` +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +... has been removed without replacement. + + +``add_label_clabeltext`` method of ``ContourLabeler`` +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +... has been removed. Use `~.ContourLabeler.add_label` instead. Passing extra positional arguments to ``Figure.add_axes`` ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/doc/users/next_whats_new/3d_clip_to_axis_limits.rst b/doc/users/next_whats_new/3d_clip_to_axis_limits.rst deleted file mode 100644 index a2230bddd66c..000000000000 --- a/doc/users/next_whats_new/3d_clip_to_axis_limits.rst +++ /dev/null @@ -1,34 +0,0 @@ -Data in 3D plots can now be dynamically clipped to the axes view limits -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -All 3D plotting functions now support the *axlim_clip* keyword argument, which -will clip the data to the axes view limits, hiding all data outside those -bounds. This clipping will be dynamically applied in real time while panning -and zooming. - -Please note that if one vertex of a line segment or 3D patch is clipped, then -the entire segment or patch will be hidden. Not being able to show partial -lines or patches such that they are "smoothly" cut off at the boundaries of the -view box is a limitation of the current renderer. - -.. plot:: - :include-source: true - :alt: Example of default behavior (blue) and axlim_clip=True (orange) - - import matplotlib.pyplot as plt - import numpy as np - - fig, ax = plt.subplots(subplot_kw={"projection": "3d"}) - x = np.arange(-5, 5, 0.5) - y = np.arange(-5, 5, 0.5) - X, Y = np.meshgrid(x, y) - R = np.sqrt(X**2 + Y**2) - Z = np.sin(R) - - # Note that when a line has one vertex outside the view limits, the entire - # line is hidden. The same is true for 3D patches (not shown). - # In this example, data where x < 0 or z > 0.5 is clipped. - ax.plot_wireframe(X, Y, Z, color='C0') - ax.plot_wireframe(X, Y, Z, color='C1', axlim_clip=True) - ax.set(xlim=(0, 10), ylim=(-5, 5), zlim=(-1, 0.5)) - ax.legend(['axlim_clip=False (default)', 'axlim_clip=True']) diff --git a/doc/users/next_whats_new/axes_creation_speedup.rst b/doc/users/next_whats_new/axes_creation_speedup.rst deleted file mode 100644 index c9eaa48c0060..000000000000 --- a/doc/users/next_whats_new/axes_creation_speedup.rst +++ /dev/null @@ -1,4 +0,0 @@ -Axes creation speedup -~~~~~~~~~~~~~~~~~~~~~ - -Creating an Axes is now 20-25% faster due to internal optimizations. diff --git a/doc/users/next_whats_new/boxplot_orientation.rst b/doc/users/next_whats_new/boxplot_orientation.rst deleted file mode 100644 index 19193b530a9e..000000000000 --- a/doc/users/next_whats_new/boxplot_orientation.rst +++ /dev/null @@ -1,21 +0,0 @@ -``boxplot`` and ``bxp`` orientation parameter -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -Boxplots have a new parameter *orientation: {"vertical", "horizontal"}* -to change the orientation of the plot. This replaces the deprecated -*vert: bool* parameter. - - -.. plot:: - :include-source: true - :alt: Example of creating 4 horizontal boxplots. - - import matplotlib.pyplot as plt - import numpy as np - - fig, ax = plt.subplots() - np.random.seed(19680801) - all_data = [np.random.normal(0, std, 100) for std in range(6, 10)] - - ax.boxplot(all_data, orientation='horizontal') - plt.show() diff --git a/doc/users/next_whats_new/ccs_color_cycle.rst b/doc/users/next_whats_new/ccs_color_cycle.rst deleted file mode 100644 index 2c9c0c85145c..000000000000 --- a/doc/users/next_whats_new/ccs_color_cycle.rst +++ /dev/null @@ -1,19 +0,0 @@ -New more-accessible color cycle -------------------------------- - -A new color cycle named 'petroff10' was added. This cycle was constructed using a -combination of algorithmically-enforced accessibility constraints, including -color-vision-deficiency modeling, and a machine-learning-based aesthetics model -developed from a crowdsourced color-preference survey. It aims to be both -generally pleasing aesthetically and colorblind accessible such that it could -serve as a default in the aim of universal design. For more details -see `Petroff, M. A.: "Accessible Color Sequences for Data Visualization" -`_ and related `SciPy talk`_. A demonstration -is included in the style sheets reference_. To load this color cycle in place -of the default:: - - import matplotlib.pyplot as plt - plt.style.use('petroff10') - -.. _reference: https://matplotlib.org/gallery/style_sheets/style_sheets_reference.html -.. _SciPy talk: https://www.youtube.com/watch?v=Gapv8wR5DYU diff --git a/doc/users/next_whats_new/contour_color.rst b/doc/users/next_whats_new/contour_color.rst deleted file mode 100644 index 1f7a326ec2b5..000000000000 --- a/doc/users/next_whats_new/contour_color.rst +++ /dev/null @@ -1,21 +0,0 @@ -Specifying a single color in ``contour`` and ``contourf`` ---------------------------------------------------------- - -`~.Axes.contour` and `~.Axes.contourf` previously accepted a single color -provided it was expressed as a string. This restriction has now been removed -and a single color in any format described in the :ref:`colors_def` tutorial -may be passed. - -.. plot:: - :include-source: true - :alt: Two-panel example contour plots. The left panel has all transparent red contours. The right panel has all dark blue contours. - - import matplotlib.pyplot as plt - - fig, (ax1, ax2) = plt.subplots(ncols=2, figsize=(6, 3)) - z = [[0, 1], [1, 2]] - - ax1.contour(z, colors=('r', 0.4)) - ax2.contour(z, colors=(0.1, 0.2, 0.5)) - - plt.show() diff --git a/doc/users/next_whats_new/diverging_colormaps.rst b/doc/users/next_whats_new/diverging_colormaps.rst deleted file mode 100644 index 8137acbf13d2..000000000000 --- a/doc/users/next_whats_new/diverging_colormaps.rst +++ /dev/null @@ -1,24 +0,0 @@ -Dark-mode diverging colormaps -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -Three diverging colormaps have been added: "berlin", "managua", and "vanimo". -They are dark-mode diverging colormaps, with minimum lightness at the center, -and maximum at the extremes. These are taken from F. Crameri's Scientific -colour maps version 8.0.1 (DOI: https://doi.org/10.5281/zenodo.1243862). - - -.. plot:: - :include-source: true - :alt: Example figures using "imshow" with dark-mode diverging colormaps on positive and negative data. First panel: "berlin" (blue to red with a black center); second panel: "managua" (orange to cyan with a dark purple center); third panel: "vanimo" (pink to green with a black center). - - import numpy as np - import matplotlib.pyplot as plt - - vals = np.linspace(-5, 5, 100) - x, y = np.meshgrid(vals, vals) - img = np.sin(x*y) - - _, ax = plt.subplots(1, 3) - ax[0].imshow(img, cmap=plt.cm.berlin) - ax[1].imshow(img, cmap=plt.cm.managua) - ax[2].imshow(img, cmap=plt.cm.vanimo) diff --git a/doc/users/next_whats_new/engformatter_offset.rst b/doc/users/next_whats_new/engformatter_offset.rst deleted file mode 100644 index c805e45444c5..000000000000 --- a/doc/users/next_whats_new/engformatter_offset.rst +++ /dev/null @@ -1,13 +0,0 @@ -``matplotlib.ticker.EngFormatter`` can computes offsets now ------------------------------------------------------------ - -`matplotlib.ticker.EngFormatter` has gained the ability to show an offset text near the -axis. Using logic shared with `matplotlib.ticker.ScalarFormatter`, it is capable of -deciding whether the data qualifies having an offset and show it with an appropriate SI -quantity prefix, and with the supplied ``unit``. - -To enable this new behavior, simply pass ``useOffset=True`` when you -instantiate `matplotlib.ticker.EngFormatter`. See example -:doc:`/gallery/ticks/engformatter_offset`. - -.. plot:: gallery/ticks/engformatter_offset.py diff --git a/doc/users/next_whats_new/exception_prop_name.rst b/doc/users/next_whats_new/exception_prop_name.rst deleted file mode 100644 index c887b879393c..000000000000 --- a/doc/users/next_whats_new/exception_prop_name.rst +++ /dev/null @@ -1,26 +0,0 @@ -Exception handling control -~~~~~~~~~~~~~~~~~~~~~~~~~~ - -The exception raised when an invalid keyword parameter is passed now includes -that parameter name as the exception's ``name`` property. This provides more -control for exception handling: - - -.. code-block:: python - - import matplotlib.pyplot as plt - - def wobbly_plot(args, **kwargs): - w = kwargs.pop('wobble_factor', None) - - try: - plt.plot(args, **kwargs) - except AttributeError as e: - raise AttributeError(f'wobbly_plot does not take parameter {e.name}') from e - - - wobbly_plot([0, 1], wibble_factor=5) - -.. code-block:: - - AttributeError: wobbly_plot does not take parameter wibble_factor diff --git a/doc/users/next_whats_new/fill_between_3d.rst b/doc/users/next_whats_new/fill_between_3d.rst deleted file mode 100644 index 13e89780d34f..000000000000 --- a/doc/users/next_whats_new/fill_between_3d.rst +++ /dev/null @@ -1,25 +0,0 @@ -Fill between 3D lines ---------------------- - -The new method `.Axes3D.fill_between` allows to fill the surface between two -3D lines with polygons. - -.. plot:: - :include-source: - :alt: Example of 3D fill_between - - N = 50 - theta = np.linspace(0, 2*np.pi, N) - - x1 = np.cos(theta) - y1 = np.sin(theta) - z1 = 0.1 * np.sin(6 * theta) - - x2 = 0.6 * np.cos(theta) - y2 = 0.6 * np.sin(theta) - z2 = 2 # Note that scalar values work in addition to length N arrays - - fig = plt.figure() - ax = fig.add_subplot(projection='3d') - ax.fill_between(x1, y1, z1, x2, y2, z2, - alpha=0.5, edgecolor='k') diff --git a/doc/users/next_whats_new/fill_between_poly_collection.rst b/doc/users/next_whats_new/fill_between_poly_collection.rst deleted file mode 100644 index 6c3b7673e631..000000000000 --- a/doc/users/next_whats_new/fill_between_poly_collection.rst +++ /dev/null @@ -1,22 +0,0 @@ -``FillBetweenPolyCollection`` ------------------------------ - -The new class :class:`matplotlib.collections.FillBetweenPolyCollection` provides -the ``set_data`` method, enabling e.g. resampling -(:file:`galleries/event_handling/resample.html`). -:func:`matplotlib.axes.Axes.fill_between` and -:func:`matplotlib.axes.Axes.fill_betweenx` now return this new class. - -.. code-block:: python - - import numpy as np - from matplotlib import pyplot as plt - - t = np.linspace(0, 1) - - fig, ax = plt.subplots() - coll = ax.fill_between(t, -t**2, t**2) - fig.savefig("before.png") - - coll.set_data(t, -t**4, t**4) - fig.savefig("after.png") diff --git a/doc/users/next_whats_new/freethreading.rst b/doc/users/next_whats_new/freethreading.rst deleted file mode 100644 index 6ed7a0d636b6..000000000000 --- a/doc/users/next_whats_new/freethreading.rst +++ /dev/null @@ -1,22 +0,0 @@ -Preliminary support for free-threaded CPython 3.13 --------------------------------------------------- - -Matplotlib 3.10 has preliminary support for the free-threaded build of CPython 3.13. See -https://py-free-threading.github.io, `PEP 703 `_ and -the `CPython 3.13 release notes -`_ for more detail -about free-threaded Python. - -Support for free-threaded Python does not mean that Matplotlib is wholly thread safe. We -expect that use of a Figure within a single thread will work, and though input data is -usually copied, modification of data objects used for a plot from another thread may -cause inconsistencies in cases where it is not. Use of any global state (such as the -``pyplot`` module) is highly discouraged and unlikely to work consistently. Also note -that most GUI toolkits expect to run on the main thread, so interactive usage may be -limited or unsupported from other threads. - -If you are interested in free-threaded Python, for example because you have a -multiprocessing-based workflow that you are interested in running with Python threads, we -encourage testing and experimentation. If you run into problems that you suspect are -because of Matplotlib, please open an issue, checking first if the bug also occurs in the -“regular” non-free-threaded CPython 3.13 build. diff --git a/doc/users/next_whats_new/histogram_vectorized_parameters.rst b/doc/users/next_whats_new/histogram_vectorized_parameters.rst deleted file mode 100644 index 7b9c04e71739..000000000000 --- a/doc/users/next_whats_new/histogram_vectorized_parameters.rst +++ /dev/null @@ -1,46 +0,0 @@ -Vectorized ``hist`` style parameters ------------------------------------- - -The parameters *hatch*, *edgecolor*, *facecolor*, *linewidth* and *linestyle* -of the `~matplotlib.axes.Axes.hist` method are now vectorized. -This means that you can pass in individual parameters for each histogram -when the input *x* has multiple datasets. - - -.. plot:: - :include-source: true - :alt: Four charts, each displaying stacked histograms of three Poisson distributions. Each chart differentiates the histograms using various parameters: top left uses different linewidths, top right uses different hatches, bottom left uses different edgecolors, and bottom right uses different facecolors. Each histogram on the left side also has a different edgecolor. - - import matplotlib.pyplot as plt - import numpy as np - np.random.seed(19680801) - - fig, ((ax1, ax2), (ax3, ax4)) = plt.subplots(2, 2, figsize=(9, 9)) - - data1 = np.random.poisson(5, 1000) - data2 = np.random.poisson(7, 1000) - data3 = np.random.poisson(10, 1000) - - labels = ["Data 1", "Data 2", "Data 3"] - - ax1.hist([data1, data2, data3], bins=range(17), histtype="step", stacked=True, - edgecolor=["red", "green", "blue"], linewidth=[1, 2, 3]) - ax1.set_title("Different linewidths") - ax1.legend(labels) - - ax2.hist([data1, data2, data3], bins=range(17), histtype="barstacked", - hatch=["/", ".", "*"]) - ax2.set_title("Different hatch patterns") - ax2.legend(labels) - - ax3.hist([data1, data2, data3], bins=range(17), histtype="bar", fill=False, - edgecolor=["red", "green", "blue"], linestyle=["--", "-.", ":"]) - ax3.set_title("Different linestyles") - ax3.legend(labels) - - ax4.hist([data1, data2, data3], bins=range(17), histtype="barstacked", - facecolor=["red", "green", "blue"]) - ax4.set_title("Different facecolors") - ax4.legend(labels) - - plt.show() diff --git a/doc/users/next_whats_new/increased_figure_limits.rst b/doc/users/next_whats_new/increased_figure_limits.rst deleted file mode 100644 index 499701cbca38..000000000000 --- a/doc/users/next_whats_new/increased_figure_limits.rst +++ /dev/null @@ -1,9 +0,0 @@ -Increased Figure limits with Agg renderer -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -Figures using the Agg renderer are now limited to 2**23 pixels in each -direction, instead of 2**16. Additionally, bugs that caused artists to not -render past 2**15 pixels horizontally have been fixed. - -Note that if you are using a GUI backend, it may have its own smaller limits -(which may themselves depend on screen size.) diff --git a/doc/users/next_whats_new/inset_indicator.rst b/doc/users/next_whats_new/inset_indicator.rst deleted file mode 100644 index 614e830e016c..000000000000 --- a/doc/users/next_whats_new/inset_indicator.rst +++ /dev/null @@ -1,18 +0,0 @@ -``InsetIndicator`` artist -~~~~~~~~~~~~~~~~~~~~~~~~~ - -`~.Axes.indicate_inset` and `~.Axes.indicate_inset_zoom` now return an instance -of `~matplotlib.inset.InsetIndicator` which contains the rectangle and -connector patches. These patches now update automatically so that - -.. code-block:: python - - ax.indicate_inset_zoom(ax_inset) - ax_inset.set_xlim(new_lim) - -now gives the same result as - -.. code-block:: python - - ax_inset.set_xlim(new_lim) - ax.indicate_inset_zoom(ax_inset) diff --git a/doc/users/next_whats_new/mouse_rotation.rst b/doc/users/next_whats_new/mouse_rotation.rst deleted file mode 100644 index c4eeab591da3..000000000000 --- a/doc/users/next_whats_new/mouse_rotation.rst +++ /dev/null @@ -1,45 +0,0 @@ -Rotating 3d plots with the mouse -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -Rotating three-dimensional plots with the mouse has been made more intuitive. -The plot now reacts the same way to mouse movement, independent of the -particular orientation at hand; and it is possible to control all 3 rotational -degrees of freedom (azimuth, elevation, and roll). By default, -it uses a variation on Ken Shoemake's ARCBALL [1]_. -The particular style of mouse rotation can be set via -:rc:`axes3d.mouserotationstyle`. -See also :ref:`toolkit_mouse-rotation`. - -To revert to the original mouse rotation style, -create a file ``matplotlibrc`` with contents:: - - axes3d.mouserotationstyle: azel - -To try out one of the various mouse rotation styles: - -.. code:: - - import matplotlib as mpl - mpl.rcParams['axes3d.mouserotationstyle'] = 'trackball' # 'azel', 'trackball', 'sphere', or 'arcball' - - import numpy as np - import matplotlib.pyplot as plt - from matplotlib import cm - - ax = plt.figure().add_subplot(projection='3d') - - X = np.arange(-5, 5, 0.25) - Y = np.arange(-5, 5, 0.25) - X, Y = np.meshgrid(X, Y) - R = np.sqrt(X**2 + Y**2) - Z = np.sin(R) - - surf = ax.plot_surface(X, Y, Z, cmap=cm.coolwarm, - linewidth=0, antialiased=False) - - plt.show() - - -.. [1] Ken Shoemake, "ARCBALL: A user interface for specifying - three-dimensional rotation using a mouse", in Proceedings of Graphics - Interface '92, 1992, pp. 151-156, https://doi.org/10.20380/GI1992.18 diff --git a/doc/users/next_whats_new/mpl_toolkit_colorbar_pad.rst b/doc/users/next_whats_new/mpl_toolkit_colorbar_pad.rst deleted file mode 100644 index f22b7c79089c..000000000000 --- a/doc/users/next_whats_new/mpl_toolkit_colorbar_pad.rst +++ /dev/null @@ -1,6 +0,0 @@ -Fix padding of single colorbar for ``ImageGrid`` ------------------------------------------------- - -``ImageGrid`` with ``cbar_mode="single"`` no longer adds the ``axes_pad`` between the -axes and the colorbar for ``cbar_location`` "left" and "bottom". If desired, add additional spacing -using ``cbar_pad``. diff --git a/doc/users/next_whats_new/pass_pandasDataFrame_into_table.rst b/doc/users/next_whats_new/pass_pandasDataFrame_into_table.rst deleted file mode 100644 index aaefa1b2011b..000000000000 --- a/doc/users/next_whats_new/pass_pandasDataFrame_into_table.rst +++ /dev/null @@ -1,20 +0,0 @@ -``ax.table`` will accept a pandas DataFrame --------------------------------------------- - -The `~.axes.Axes.table` method can now accept a Pandas DataFrame for the ``cellText`` argument. - -.. code-block:: python - - import matplotlib.pyplot as plt - import pandas as pd - - data = { - 'Letter': ['A', 'B', 'C'], - 'Number': [100, 200, 300] - } - - df = pd.DataFrame(data) - fig, ax = plt.subplots() - table = ax.table(df, loc='center') # or table = ax.table(cellText=df, loc='center') - ax.axis('off') - plt.show() diff --git a/doc/users/next_whats_new/subfigures_change_order.rst b/doc/users/next_whats_new/subfigures_change_order.rst deleted file mode 100644 index e059d71755bc..000000000000 --- a/doc/users/next_whats_new/subfigures_change_order.rst +++ /dev/null @@ -1,29 +0,0 @@ -Subfigures no longer provisional --------------------------------- - -The API on `.Figure.subfigures` and `.SubFigure` are now considered stable. - - -Subfigures are now added in row-major order -------------------------------------------- - -``Figure.subfigures`` are now added in row-major order for API consistency. - - -.. plot:: - :include-source: true - :alt: Example of creating 3 by 3 subfigures. - - import matplotlib.pyplot as plt - - fig = plt.figure() - subfigs = fig.subfigures(3, 3) - x = np.linspace(0, 10, 100) - - for i, sf in enumerate(fig.subfigs): - ax = sf.subplots() - ax.plot(x, np.sin(x + i), label=f'Subfigure {i+1}') - sf.suptitle(f'Subfigure {i+1}') - ax.set_xticks([]) - ax.set_yticks([]) - plt.show() diff --git a/doc/users/next_whats_new/svg_id_rc.rst b/doc/users/next_whats_new/svg_id_rc.rst deleted file mode 100644 index 531d14860167..000000000000 --- a/doc/users/next_whats_new/svg_id_rc.rst +++ /dev/null @@ -1,32 +0,0 @@ -``svg.id`` rcParam -~~~~~~~~~~~~~~~~~~ -:rc:`svg.id` lets you insert an ``id`` attribute into the top-level ```` tag. - -e.g. ``rcParams["svg.id"] = "svg1"`` results in -default), no ``id`` tag is included - -.. code-block:: XML - - - -This is useful if you would like to link the entire matplotlib SVG file within -another SVG file with the ```` tag. - -.. code-block:: XML - - - - -Where the ``#svg1`` indicator will now refer to the top level ```` tag, and -will hence result in the inclusion of the entire file. diff --git a/doc/users/next_whats_new/update_features.rst b/doc/users/next_whats_new/update_features.rst deleted file mode 100644 index a655a06b9e23..000000000000 --- a/doc/users/next_whats_new/update_features.rst +++ /dev/null @@ -1,4 +0,0 @@ -Miscellaneous Changes ---------------------- - -- The `matplotlib.ticker.ScalarFormatter` class has gained a new instantiating parameter ``usetex``. diff --git a/doc/users/next_whats_new/violinplot_orientation.rst b/doc/users/next_whats_new/violinplot_orientation.rst deleted file mode 100644 index 23d81446ad35..000000000000 --- a/doc/users/next_whats_new/violinplot_orientation.rst +++ /dev/null @@ -1,21 +0,0 @@ -``violinplot`` and ``violin`` orientation parameter -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -Violinplots have a new parameter *orientation: {"vertical", "horizontal"}* -to change the orientation of the plot. This will replace the deprecated -*vert: bool* parameter. - - -.. plot:: - :include-source: true - :alt: Example of creating 4 horizontal violinplots. - - import matplotlib.pyplot as plt - import numpy as np - - fig, ax = plt.subplots() - np.random.seed(19680801) - all_data = [np.random.normal(0, std, 100) for std in range(6, 10)] - - ax.violinplot(all_data, orientation='horizontal') - plt.show() diff --git a/doc/users/prev_whats_new/whats_new_3.10.0.rst b/doc/users/prev_whats_new/whats_new_3.10.0.rst new file mode 100644 index 000000000000..bc160787aebc --- /dev/null +++ b/doc/users/prev_whats_new/whats_new_3.10.0.rst @@ -0,0 +1,479 @@ +New more-accessible color cycle +------------------------------- + +A new color cycle named 'petroff10' was added. This cycle was constructed using a +combination of algorithmically-enforced accessibility constraints, including +color-vision-deficiency modeling, and a machine-learning-based aesthetics model +developed from a crowdsourced color-preference survey. It aims to be both +generally pleasing aesthetically and colorblind accessible such that it could +serve as a default in the aim of universal design. For more details +see `Petroff, M. A.: "Accessible Color Sequences for Data Visualization" +`_ and related `SciPy talk`_. A demonstration +is included in the style sheets reference_. To load this color cycle in place +of the default:: + + import matplotlib.pyplot as plt + plt.style.use('petroff10') + +.. _reference: https://matplotlib.org/gallery/style_sheets/style_sheets_reference.html +.. _SciPy talk: https://www.youtube.com/watch?v=Gapv8wR5DYU + +Dark-mode diverging colormaps +----------------------------- + +Three diverging colormaps have been added: "berlin", "managua", and "vanimo". +They are dark-mode diverging colormaps, with minimum lightness at the center, +and maximum at the extremes. These are taken from F. Crameri's Scientific +colour maps version 8.0.1 (DOI: https://doi.org/10.5281/zenodo.1243862). + + +.. plot:: + :include-source: true + :alt: Example figures using "imshow" with dark-mode diverging colormaps on positive and negative data. First panel: "berlin" (blue to red with a black center); second panel: "managua" (orange to cyan with a dark purple center); third panel: "vanimo" (pink to green with a black center). + + import numpy as np + import matplotlib.pyplot as plt + + vals = np.linspace(-5, 5, 100) + x, y = np.meshgrid(vals, vals) + img = np.sin(x*y) + + _, ax = plt.subplots(1, 3) + ax[0].imshow(img, cmap=plt.cm.berlin) + ax[1].imshow(img, cmap=plt.cm.managua) + ax[2].imshow(img, cmap=plt.cm.vanimo) + +Specifying a single color in ``contour`` and ``contourf`` +--------------------------------------------------------- + +`~.Axes.contour` and `~.Axes.contourf` previously accepted a single color +provided it was expressed as a string. This restriction has now been removed +and a single color in any format described in the :ref:`colors_def` tutorial +may be passed. + +.. plot:: + :include-source: true + :alt: Two-panel example contour plots. The left panel has all transparent red contours. The right panel has all dark blue contours. + + import matplotlib.pyplot as plt + + fig, (ax1, ax2) = plt.subplots(ncols=2, figsize=(6, 3)) + z = [[0, 1], [1, 2]] + + ax1.contour(z, colors=('r', 0.4)) + ax2.contour(z, colors=(0.1, 0.2, 0.5)) + + plt.show() + +Exception handling control +-------------------------- + +The exception raised when an invalid keyword parameter is passed now includes +that parameter name as the exception's ``name`` property. This provides more +control for exception handling: + + +.. code-block:: python + + import matplotlib.pyplot as plt + + def wobbly_plot(args, **kwargs): + w = kwargs.pop('wobble_factor', None) + + try: + plt.plot(args, **kwargs) + except AttributeError as e: + raise AttributeError(f'wobbly_plot does not take parameter {e.name}') from e + + + wobbly_plot([0, 1], wibble_factor=5) + +.. code-block:: + + AttributeError: wobbly_plot does not take parameter wibble_factor + +Preliminary support for free-threaded CPython 3.13 +-------------------------------------------------- + +Matplotlib 3.10 has preliminary support for the free-threaded build of CPython 3.13. See +https://py-free-threading.github.io, `PEP 703 `_ and +the `CPython 3.13 release notes +`_ for more detail +about free-threaded Python. + +Support for free-threaded Python does not mean that Matplotlib is wholly thread safe. We +expect that use of a Figure within a single thread will work, and though input data is +usually copied, modification of data objects used for a plot from another thread may +cause inconsistencies in cases where it is not. Use of any global state (such as the +``pyplot`` module) is highly discouraged and unlikely to work consistently. Also note +that most GUI toolkits expect to run on the main thread, so interactive usage may be +limited or unsupported from other threads. + +If you are interested in free-threaded Python, for example because you have a +multiprocessing-based workflow that you are interested in running with Python threads, we +encourage testing and experimentation. If you run into problems that you suspect are +because of Matplotlib, please open an issue, checking first if the bug also occurs in the +“regular” non-free-threaded CPython 3.13 build. + +Increased Figure limits with Agg renderer +----------------------------------------- + +Figures using the Agg renderer are now limited to 2**23 pixels in each +direction, instead of 2**16. Additionally, bugs that caused artists to not +render past 2**15 pixels horizontally have been fixed. + +Note that if you are using a GUI backend, it may have its own smaller limits +(which may themselves depend on screen size.) + +Vectorized ``hist`` style parameters +------------------------------------ + +The parameters *hatch*, *edgecolor*, *facecolor*, *linewidth* and *linestyle* +of the `~matplotlib.axes.Axes.hist` method are now vectorized. +This means that you can pass in individual parameters for each histogram +when the input *x* has multiple datasets. + + +.. plot:: + :include-source: true + :alt: Four charts, each displaying stacked histograms of three Poisson distributions. Each chart differentiates the histograms using various parameters: top left uses different linewidths, top right uses different hatches, bottom left uses different edgecolors, and bottom right uses different facecolors. Each histogram on the left side also has a different edgecolor. + + import matplotlib.pyplot as plt + import numpy as np + np.random.seed(19680801) + + fig, ((ax1, ax2), (ax3, ax4)) = plt.subplots(2, 2, figsize=(9, 9)) + + data1 = np.random.poisson(5, 1000) + data2 = np.random.poisson(7, 1000) + data3 = np.random.poisson(10, 1000) + + labels = ["Data 1", "Data 2", "Data 3"] + + ax1.hist([data1, data2, data3], bins=range(17), histtype="step", stacked=True, + edgecolor=["red", "green", "blue"], linewidth=[1, 2, 3]) + ax1.set_title("Different linewidths") + ax1.legend(labels) + + ax2.hist([data1, data2, data3], bins=range(17), histtype="barstacked", + hatch=["/", ".", "*"]) + ax2.set_title("Different hatch patterns") + ax2.legend(labels) + + ax3.hist([data1, data2, data3], bins=range(17), histtype="bar", fill=False, + edgecolor=["red", "green", "blue"], linestyle=["--", "-.", ":"]) + ax3.set_title("Different linestyles") + ax3.legend(labels) + + ax4.hist([data1, data2, data3], bins=range(17), histtype="barstacked", + facecolor=["red", "green", "blue"]) + ax4.set_title("Different facecolors") + ax4.legend(labels) + + plt.show() + +``InsetIndicator`` artist +------------------------- + +`~.Axes.indicate_inset` and `~.Axes.indicate_inset_zoom` now return an instance +of `~matplotlib.inset.InsetIndicator` which contains the rectangle and +connector patches. These patches now update automatically so that + +.. code-block:: python + + ax.indicate_inset_zoom(ax_inset) + ax_inset.set_xlim(new_lim) + +now gives the same result as + +.. code-block:: python + + ax_inset.set_xlim(new_lim) + ax.indicate_inset_zoom(ax_inset) + +``matplotlib.ticker.EngFormatter`` can computes offsets now +----------------------------------------------------------- + +`matplotlib.ticker.EngFormatter` has gained the ability to show an offset text near the +axis. Using logic shared with `matplotlib.ticker.ScalarFormatter`, it is capable of +deciding whether the data qualifies having an offset and show it with an appropriate SI +quantity prefix, and with the supplied ``unit``. + +To enable this new behavior, simply pass ``useOffset=True`` when you +instantiate `matplotlib.ticker.EngFormatter`. See example +:doc:`/gallery/ticks/engformatter_offset`. + +.. plot:: gallery/ticks/engformatter_offset.py + + +Fix padding of single colorbar for ``ImageGrid`` +------------------------------------------------ + +``ImageGrid`` with ``cbar_mode="single"`` no longer adds the ``axes_pad`` between the +axes and the colorbar for ``cbar_location`` "left" and "bottom". If desired, add additional spacing +using ``cbar_pad``. + +``ax.table`` will accept a pandas DataFrame +-------------------------------------------- + +The `~.axes.Axes.table` method can now accept a Pandas DataFrame for the ``cellText`` argument. + +.. code-block:: python + + import matplotlib.pyplot as plt + import pandas as pd + + data = { + 'Letter': ['A', 'B', 'C'], + 'Number': [100, 200, 300] + } + + df = pd.DataFrame(data) + fig, ax = plt.subplots() + table = ax.table(df, loc='center') # or table = ax.table(cellText=df, loc='center') + ax.axis('off') + plt.show() + + +Subfigures are now added in row-major order +------------------------------------------- + +``Figure.subfigures`` are now added in row-major order for API consistency. + + +.. plot:: + :include-source: true + :alt: Example of creating 3 by 3 subfigures. + + import matplotlib.pyplot as plt + + fig = plt.figure() + subfigs = fig.subfigures(3, 3) + x = np.linspace(0, 10, 100) + + for i, sf in enumerate(fig.subfigs): + ax = sf.subplots() + ax.plot(x, np.sin(x + i), label=f'Subfigure {i+1}') + sf.suptitle(f'Subfigure {i+1}') + ax.set_xticks([]) + ax.set_yticks([]) + plt.show() + +``svg.id`` rcParam +------------------ + +:rc:`svg.id` lets you insert an ``id`` attribute into the top-level ```` tag. + +e.g. ``rcParams["svg.id"] = "svg1"`` results in +default), no ``id`` tag is included + +.. code-block:: XML + + + +This is useful if you would like to link the entire matplotlib SVG file within +another SVG file with the ```` tag. + +.. code-block:: XML + + + + +Where the ``#svg1`` indicator will now refer to the top level ```` tag, and +will hence result in the inclusion of the entire file. + +``boxplot`` and ``bxp`` orientation parameter +--------------------------------------------- + +Boxplots have a new parameter *orientation: {"vertical", "horizontal"}* +to change the orientation of the plot. This replaces the deprecated +*vert: bool* parameter. + + +.. plot:: + :include-source: true + :alt: Example of creating 4 horizontal boxplots. + + import matplotlib.pyplot as plt + import numpy as np + + fig, ax = plt.subplots() + np.random.seed(19680801) + all_data = [np.random.normal(0, std, 100) for std in range(6, 10)] + + ax.boxplot(all_data, orientation='horizontal') + plt.show() + + +``violinplot`` and ``violin`` orientation parameter +--------------------------------------------------- + +Violinplots have a new parameter *orientation: {"vertical", "horizontal"}* +to change the orientation of the plot. This will replace the deprecated +*vert: bool* parameter. + + +.. plot:: + :include-source: true + :alt: Example of creating 4 horizontal violinplots. + + import matplotlib.pyplot as plt + import numpy as np + + fig, ax = plt.subplots() + np.random.seed(19680801) + all_data = [np.random.normal(0, std, 100) for std in range(6, 10)] + + ax.violinplot(all_data, orientation='horizontal') + plt.show() + +``FillBetweenPolyCollection`` +----------------------------- + +The new class :class:`matplotlib.collections.FillBetweenPolyCollection` provides +the ``set_data`` method, enabling e.g. resampling +(:file:`galleries/event_handling/resample.html`). +:func:`matplotlib.axes.Axes.fill_between` and +:func:`matplotlib.axes.Axes.fill_betweenx` now return this new class. + +.. code-block:: python + + import numpy as np + from matplotlib import pyplot as plt + + t = np.linspace(0, 1) + + fig, ax = plt.subplots() + coll = ax.fill_between(t, -t**2, t**2) + fig.savefig("before.png") + + coll.set_data(t, -t**4, t**4) + fig.savefig("after.png") + +Fill between 3D lines +--------------------- + +The new method `.Axes3D.fill_between` allows to fill the surface between two +3D lines with polygons. + +.. plot:: + :include-source: + :alt: Example of 3D fill_between + + N = 50 + theta = np.linspace(0, 2*np.pi, N) + + x1 = np.cos(theta) + y1 = np.sin(theta) + z1 = 0.1 * np.sin(6 * theta) + + x2 = 0.6 * np.cos(theta) + y2 = 0.6 * np.sin(theta) + z2 = 2 # Note that scalar values work in addition to length N arrays + + fig = plt.figure() + ax = fig.add_subplot(projection='3d') + ax.fill_between(x1, y1, z1, x2, y2, z2, + alpha=0.5, edgecolor='k') + +Rotating 3d plots with the mouse +-------------------------------- + +Rotating three-dimensional plots with the mouse has been made more intuitive. +The plot now reacts the same way to mouse movement, independent of the +particular orientation at hand; and it is possible to control all 3 rotational +degrees of freedom (azimuth, elevation, and roll). By default, +it uses a variation on Ken Shoemake's ARCBALL [1]_. +The particular style of mouse rotation can be set via +:rc:`axes3d.mouserotationstyle`. +See also :ref:`toolkit_mouse-rotation`. + +To revert to the original mouse rotation style, +create a file ``matplotlibrc`` with contents:: + + axes3d.mouserotationstyle: azel + +To try out one of the various mouse rotation styles: + +.. code:: + + import matplotlib as mpl + mpl.rcParams['axes3d.mouserotationstyle'] = 'trackball' # 'azel', 'trackball', 'sphere', or 'arcball' + + import numpy as np + import matplotlib.pyplot as plt + from matplotlib import cm + + ax = plt.figure().add_subplot(projection='3d') + + X = np.arange(-5, 5, 0.25) + Y = np.arange(-5, 5, 0.25) + X, Y = np.meshgrid(X, Y) + R = np.sqrt(X**2 + Y**2) + Z = np.sin(R) + + surf = ax.plot_surface(X, Y, Z, cmap=cm.coolwarm, + linewidth=0, antialiased=False) + + plt.show() + + +.. [1] Ken Shoemake, "ARCBALL: A user interface for specifying + three-dimensional rotation using a mouse", in Proceedings of Graphics + Interface '92, 1992, pp. 151-156, https://doi.org/10.20380/GI1992.18 + + + +Data in 3D plots can now be dynamically clipped to the axes view limits +----------------------------------------------------------------------- + +All 3D plotting functions now support the *axlim_clip* keyword argument, which +will clip the data to the axes view limits, hiding all data outside those +bounds. This clipping will be dynamically applied in real time while panning +and zooming. + +Please note that if one vertex of a line segment or 3D patch is clipped, then +the entire segment or patch will be hidden. Not being able to show partial +lines or patches such that they are "smoothly" cut off at the boundaries of the +view box is a limitation of the current renderer. + +.. plot:: + :include-source: true + :alt: Example of default behavior (blue) and axlim_clip=True (orange) + + import matplotlib.pyplot as plt + import numpy as np + + fig, ax = plt.subplots(subplot_kw={"projection": "3d"}) + x = np.arange(-5, 5, 0.5) + y = np.arange(-5, 5, 0.5) + X, Y = np.meshgrid(x, y) + R = np.sqrt(X**2 + Y**2) + Z = np.sin(R) + + # Note that when a line has one vertex outside the view limits, the entire + # line is hidden. The same is true for 3D patches (not shown). + # In this example, data where x < 0 or z > 0.5 is clipped. + ax.plot_wireframe(X, Y, Z, color='C0') + ax.plot_wireframe(X, Y, Z, color='C1', axlim_clip=True) + ax.set(xlim=(0, 10), ylim=(-5, 5), zlim=(-1, 0.5)) + ax.legend(['axlim_clip=False (default)', 'axlim_clip=True']) + + +Miscellaneous Changes +--------------------- + +- The `matplotlib.ticker.ScalarFormatter` class has gained a new instantiating parameter ``usetex``. +- Creating an Axes is now 20-25% faster due to internal optimizations. +- The API on `.Figure.subfigures` and `.SubFigure` are now considered stable. diff --git a/doc/users/release_notes.rst b/doc/users/release_notes.rst index b5e58eb6e87e..3bb30bf2fa49 100644 --- a/doc/users/release_notes.rst +++ b/doc/users/release_notes.rst @@ -12,6 +12,14 @@ Release notes .. include:: release_notes_next.rst +Version 3.10 +^^^^^^^^^^^^ +.. toctree:: + :maxdepth: 1 + + prev_whats_new/whats_new_3.10.0.rst + ../api/prev_api_changes/api_changes_3.10.0.rst + prev_whats_new/github_stats_3.10.0.rst Version 3.9 ^^^^^^^^^^^ From d9dfee852191caaf0b12d14c9a387edebc5ef8e6 Mon Sep 17 00:00:00 2001 From: Kyle Sunden Date: Fri, 13 Dec 2024 20:18:16 -0600 Subject: [PATCH 112/131] [doc] Fix dead links --- doc/install/dependencies.rst | 2 +- doc/users/resources/index.rst | 4 ++-- galleries/examples/misc/image_thumbnail_sgskip.py | 2 +- galleries/users_explain/axes/arranging_axes.py | 2 +- galleries/users_explain/figure/backends.rst | 2 +- .../figure/writing_a_backend_pyplot_interface.rst | 2 +- lib/matplotlib/cbook.py | 4 ++-- lib/matplotlib/image.py | 2 +- src/_tkagg.cpp | 2 +- 9 files changed, 11 insertions(+), 11 deletions(-) diff --git a/doc/install/dependencies.rst b/doc/install/dependencies.rst index ea1c6787b52b..b8f54f346186 100644 --- a/doc/install/dependencies.rst +++ b/doc/install/dependencies.rst @@ -434,5 +434,5 @@ process will raise various warnings. * `Inkscape `_ * `optipng `_ -* the font `xkcd script `_ or `Comic Neue `_ +* the font `xkcd script `_ or `Comic Neue `_ * the font "Times New Roman" diff --git a/doc/users/resources/index.rst b/doc/users/resources/index.rst index 77010f176048..7e2339ee8191 100644 --- a/doc/users/resources/index.rst +++ b/doc/users/resources/index.rst @@ -54,8 +54,8 @@ Videos `_ by Eric Jones * `Anatomy of Matplotlib - `_ - by Benjamin Root + `_ + by Benjamin Root and Hannah Aizenman * `Data Visualization Basics with Python (O'Reilly) `_ diff --git a/galleries/examples/misc/image_thumbnail_sgskip.py b/galleries/examples/misc/image_thumbnail_sgskip.py index 55217cfdca02..e361d3bf53ab 100644 --- a/galleries/examples/misc/image_thumbnail_sgskip.py +++ b/galleries/examples/misc/image_thumbnail_sgskip.py @@ -7,7 +7,7 @@ Matplotlib relies on Pillow_ for reading images, and thus supports all formats supported by Pillow. -.. _Pillow: https://python-pillow.org/ +.. _Pillow: https://python-pillow.github.io """ from argparse import ArgumentParser diff --git a/galleries/users_explain/axes/arranging_axes.py b/galleries/users_explain/axes/arranging_axes.py index 1f910393a9da..bc537e15c12c 100644 --- a/galleries/users_explain/axes/arranging_axes.py +++ b/galleries/users_explain/axes/arranging_axes.py @@ -308,7 +308,7 @@ def annotate_axes(ax, text, fontsize=18): # ------------------------------------- # # We can index the *spec* array using `NumPy slice syntax -# `_ +# `_ # and the new Axes will span the slice. This would be the same # as ``fig, axd = plt.subplot_mosaic([['ax0', 'ax0'], ['ax1', 'ax2']], ...)``: diff --git a/galleries/users_explain/figure/backends.rst b/galleries/users_explain/figure/backends.rst index dc6d8a89457d..b808d5951fd8 100644 --- a/galleries/users_explain/figure/backends.rst +++ b/galleries/users_explain/figure/backends.rst @@ -211,7 +211,7 @@ wxAgg Agg rendering to a wxWidgets_ canvas (requires wxPython_ 4). .. _`Scalable Vector Graphics`: https://en.wikipedia.org/wiki/Scalable_Vector_Graphics .. _pgf: https://ctan.org/pkg/pgf .. _Cairo: https://www.cairographics.org -.. _PyGObject: https://wiki.gnome.org/action/show/Projects/PyGObject +.. _PyGObject: https://pygobject.gnome.org/ .. _pycairo: https://www.cairographics.org/pycairo/ .. _cairocffi: https://doc.courtbouillon.org/cairocffi/stable/ .. _wxPython: https://www.wxpython.org/ diff --git a/galleries/users_explain/figure/writing_a_backend_pyplot_interface.rst b/galleries/users_explain/figure/writing_a_backend_pyplot_interface.rst index c8dccc24da43..5325b3d9ba4c 100644 --- a/galleries/users_explain/figure/writing_a_backend_pyplot_interface.rst +++ b/galleries/users_explain/figure/writing_a_backend_pyplot_interface.rst @@ -107,7 +107,7 @@ module:// syntax Any backend in a separate module (not built into Matplotlib) can be used by specifying the path to the module in the form ``module://some.backend.module``. An example is ``module://mplcairo.qt`` for -`mplcairo `_. The backend's +`mplcairo `_. The backend's interactive framework will be taken from its ``FigureCanvas.required_interactive_framework``. diff --git a/lib/matplotlib/cbook.py b/lib/matplotlib/cbook.py index 3c1593ea2e37..da7a122b0968 100644 --- a/lib/matplotlib/cbook.py +++ b/lib/matplotlib/cbook.py @@ -615,9 +615,9 @@ def flatten(seq, scalarp=is_scalar_or_string): ['John', 'Hunter', 1, 23, 42, 5, 23] By: Composite of Holger Krekel and Luther Blissett - From: https://code.activestate.com/recipes/121294/ + From: https://code.activestate.com/recipes/121294-simple-generator-for-flattening-nested-containers/ and Recipe 1.12 in cookbook - """ + """ # noqa: E501 for item in seq: if scalarp(item) or item is None: yield item diff --git a/lib/matplotlib/image.py b/lib/matplotlib/image.py index f73bd3af6acb..37a1d11678fa 100644 --- a/lib/matplotlib/image.py +++ b/lib/matplotlib/image.py @@ -1713,7 +1713,7 @@ def thumbnail(infile, thumbfile, scale=0.1, interpolation='bilinear', thus supports a wide range of file formats, including PNG, JPG, TIFF and others. - .. _Pillow: https://python-pillow.org/ + .. _Pillow: https://python-pillow.github.io thumbfile : str or file-like The thumbnail filename. diff --git a/src/_tkagg.cpp b/src/_tkagg.cpp index bfb19cc476ea..874f6afb1b52 100644 --- a/src/_tkagg.cpp +++ b/src/_tkagg.cpp @@ -7,7 +7,7 @@ // and methods of operation are now quite different. Because our review of // the codebase showed that all the code that came from PIL was removed or // rewritten, we have removed the PIL licensing information. If you want PIL, -// you can get it at https://python-pillow.org/ +// you can get it at https://python-pillow.github.io #include #include From 8d64f03a1f501ba0019279bf2f8db3930d1fe33f Mon Sep 17 00:00:00 2001 From: Kyle Sunden Date: Fri, 13 Dec 2024 23:21:05 -0600 Subject: [PATCH 113/131] REL: v3.10.0 release Highlights of this release include: - Preliminary support for free-threaded CPython 3.13 - Standard getters/setters for axis inversion state - New more-accessible color cycle - Dark-mode diverging colormaps - Exception handling control - InsetIndicator artist - FillBetweenPolyCollection - Fill between 3D lines - Data in 3D plots can now be dynamically clipped to the axes view limits - Rotating 3d plots with the mouse - Increased Figure limits with Agg renderer - Subfigures no longer provisional - Subfigures are now added in row-major order From 66784dfa15dd9a93ca0f61c13bbf34c9335880e9 Mon Sep 17 00:00:00 2001 From: Kyle Sunden Date: Fri, 13 Dec 2024 23:27:24 -0600 Subject: [PATCH 114/131] Bump from v3.10.0 tag From ac4e76a4cc2cc505baf13e44954c022daafffcf8 Mon Sep 17 00:00:00 2001 From: Tim Hoffmann <2836374+timhoffm@users.noreply.github.com> Date: Sat, 14 Dec 2024 09:19:59 +0100 Subject: [PATCH 115/131] Backport PR #29308: Update cibuildwheel workflow --- .github/workflows/cibuildwheel.yml | 24 +++++------------------- 1 file changed, 5 insertions(+), 19 deletions(-) diff --git a/.github/workflows/cibuildwheel.yml b/.github/workflows/cibuildwheel.yml index b1e5204ab12a..9dc5e01cca58 100644 --- a/.github/workflows/cibuildwheel.yml +++ b/.github/workflows/cibuildwheel.yml @@ -34,7 +34,7 @@ jobs: 'CI: Run cibuildwheel') ) name: Build sdist - runs-on: ubuntu-20.04 + runs-on: ubuntu-latest outputs: SDIST_NAME: ${{ steps.sdist.outputs.SDIST_NAME }} @@ -119,9 +119,9 @@ jobs: strategy: matrix: include: - - os: ubuntu-20.04 + - os: ubuntu-latest cibw_archs: "x86_64" - - os: ubuntu-20.04 + - os: ubuntu-latest cibw_archs: "aarch64" - os: windows-latest cibw_archs: "auto64" @@ -149,16 +149,9 @@ jobs: package-dir: dist/${{ needs.build_sdist.outputs.SDIST_NAME }} env: CIBW_BUILD: "cp313-* cp313t-*" - CIBW_BUILD_FRONTEND: - "pip; args: --pre --extra-index-url https://pypi.anaconda.org/scientific-python-nightly-wheels/simple" - CIBW_FREE_THREADED_SUPPORT: true + CIBW_ENABLE: cpython-freethreading # No free-threading wheels available for aarch64 on Pillow. CIBW_TEST_SKIP: "cp313t-manylinux_aarch64" - # We need pre-releases to get the nightly wheels. - CIBW_BEFORE_TEST: >- - pip install --pre - --extra-index-url https://pypi.anaconda.org/scientific-python-nightly-wheels/simple - contourpy numpy pillow CIBW_ARCHS: ${{ matrix.cibw_archs }} - name: Build wheels for CPython 3.12 @@ -192,14 +185,7 @@ jobs: env: CIBW_BUILD: "pp310-*" CIBW_ARCHS: ${{ matrix.cibw_archs }} - # Work around for https://github.com/pypa/setuptools/issues/4571 - # This can be removed once kiwisolver has wheels for PyPy 3.10 - # https://github.com/nucleic/kiwi/pull/182 - CIBW_BEFORE_TEST: >- - export PIP_CONSTRAINT=pypy-constraint.txt && - echo "setuptools!=72.2.0" > $PIP_CONSTRAINT && - pip install kiwisolver && - unset PIP_CONSTRAINT + CIBW_ENABLE: pypy if: matrix.cibw_archs != 'aarch64' && matrix.os != 'windows-latest' - uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3 From a65f9eae6c328e0e6190a370b57dc73613e29aec Mon Sep 17 00:00:00 2001 From: saikarna913 Date: Sat, 14 Dec 2024 13:52:09 +0530 Subject: [PATCH 116/131] Backport PR #29292: Update dependencies.rst --- doc/install/dependencies.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/install/dependencies.rst b/doc/install/dependencies.rst index b8f54f346186..3034a64a3361 100644 --- a/doc/install/dependencies.rst +++ b/doc/install/dependencies.rst @@ -256,7 +256,7 @@ source files. .. tab-item:: Linux On some Linux systems, you can install a meta-build package. For example, - on Ubuntu ``apt install build-essential`` + on Ubuntu ``apt install build-essential`` with elevated privileges. Otherwise, use the system distribution's package manager to install :ref:`gcc `. From 6c103ce816796e49b9305ff937f6e3a4610562cc Mon Sep 17 00:00:00 2001 From: Tim Hoffmann <2836374+timhoffm@users.noreply.github.com> Date: Sat, 14 Dec 2024 20:20:58 +0100 Subject: [PATCH 117/131] Backport PR #29314: DOC: fix footnote in choosing colormaps guide --- galleries/users_explain/colors/colormaps.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/galleries/users_explain/colors/colormaps.py b/galleries/users_explain/colors/colormaps.py index ff146cacf170..026ffc9922e2 100644 --- a/galleries/users_explain/colors/colormaps.py +++ b/galleries/users_explain/colors/colormaps.py @@ -178,7 +178,7 @@ def plot_color_gradients(category, cmap_list): # # Berlin, Managua, and Vanimo are dark-mode diverging colormaps, with minimum # lightness at the center, and maximum at the extremes. These are taken from -# F. Crameri's [scientific colour maps]_ version 8.0.1. +# F. Crameri's [scientific-colour-maps]_ version 8.0.1. plot_color_gradients('Diverging', ['PiYG', 'PRGn', 'BrBG', 'PuOr', 'RdGy', 'RdBu', 'RdYlBu', @@ -446,4 +446,4 @@ def plot_color_gradients(cmap_category, cmap_list): # .. [colorblindness] http://www.color-blindness.com/ # .. [IBM] https://doi.org/10.1109/VISUAL.1995.480803 # .. [turbo] https://ai.googleblog.com/2019/08/turbo-improved-rainbow-colormap-for.html -# .. [scientific colour maps] https://doi.org/10.5281/zenodo.1243862 +# .. [scientific-colour-maps] https://doi.org/10.5281/zenodo.1243862 From 8cb86a37c7fcce70dd205839727ed43ee19934f0 Mon Sep 17 00:00:00 2001 From: Tim Hoffmann <2836374+timhoffm@users.noreply.github.com> Date: Mon, 16 Dec 2024 09:41:36 +0100 Subject: [PATCH 118/131] Backport PR #29317: FIX: pass renderer through `_auto_legend_data` --- lib/matplotlib/legend.py | 6 +++--- lib/matplotlib/tests/test_legend.py | 16 ++++++++++++++++ 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/lib/matplotlib/legend.py b/lib/matplotlib/legend.py index ace3f668e740..0c2dfc19705c 100644 --- a/lib/matplotlib/legend.py +++ b/lib/matplotlib/legend.py @@ -934,7 +934,7 @@ def _init_legend_box(self, handles, labels, markerfirst=True): self.texts = text_list self.legend_handles = handle_list - def _auto_legend_data(self): + def _auto_legend_data(self, renderer): """ Return display coordinates for hit testing for "best" positioning. @@ -969,7 +969,7 @@ def _auto_legend_data(self): if len(hoffsets): offsets.extend(transOffset.transform(hoffsets)) elif isinstance(artist, Text): - bboxes.append(artist.get_window_extent()) + bboxes.append(artist.get_window_extent(renderer)) return bboxes, lines, offsets @@ -1150,7 +1150,7 @@ def _find_best_position(self, width, height, renderer): start_time = time.perf_counter() - bboxes, lines, offsets = self._auto_legend_data() + bboxes, lines, offsets = self._auto_legend_data(renderer) bbox = Bbox.from_bounds(0, 0, width, height) diff --git a/lib/matplotlib/tests/test_legend.py b/lib/matplotlib/tests/test_legend.py index 61892378bd03..67b10fb2a365 100644 --- a/lib/matplotlib/tests/test_legend.py +++ b/lib/matplotlib/tests/test_legend.py @@ -1,4 +1,5 @@ import collections +import io import itertools import platform import time @@ -1427,6 +1428,21 @@ def test_legend_text(): assert_allclose(leg_bboxes[1].bounds, leg_bboxes[0].bounds) +def test_legend_annotate(): + fig, ax = plt.subplots() + + ax.plot([1, 2, 3], label="Line") + ax.annotate("a", xy=(1, 1)) + ax.legend(loc=0) + + with mock.patch.object( + fig, '_get_renderer', wraps=fig._get_renderer) as mocked_get_renderer: + fig.savefig(io.BytesIO()) + + # Finding the legend position should not require _get_renderer to be called + mocked_get_renderer.assert_not_called() + + def test_boxplot_legend_labels(): # Test that legend entries are generated when passing `label`. np.random.seed(19680801) From 0e995cee47595295cddd0889856661db416ac0db Mon Sep 17 00:00:00 2001 From: saikarna913 Date: Mon, 16 Dec 2024 19:53:44 +0530 Subject: [PATCH 119/131] Backport PR #29258: Adding font Size as default parameter --- lib/matplotlib/table.py | 4 ++++ lib/matplotlib/tests/test_table.py | 12 ++++++++++++ 2 files changed, 16 insertions(+) diff --git a/lib/matplotlib/table.py b/lib/matplotlib/table.py index 21518c4c6726..370ce9fe922f 100644 --- a/lib/matplotlib/table.py +++ b/lib/matplotlib/table.py @@ -838,5 +838,9 @@ def table(ax, if rowLabelWidth == 0: table.auto_set_column_width(-1) + # set_fontsize is only effective after cells are added + if "fontsize" in kwargs: + table.set_fontsize(kwargs["fontsize"]) + ax.add_table(table) return table diff --git a/lib/matplotlib/tests/test_table.py b/lib/matplotlib/tests/test_table.py index ee974f3cd8f9..783be25376be 100644 --- a/lib/matplotlib/tests/test_table.py +++ b/lib/matplotlib/tests/test_table.py @@ -270,3 +270,15 @@ def test_table_dataframe(pd): for r, (index, row) in enumerate(df.iterrows()): for c, col in enumerate(df.columns if r == 0 else row.values): assert table[r if r == 0 else r+1, c].get_text().get_text() == str(col) + + +def test_table_fontsize(): + # Test that the passed fontsize propagates to cells + tableData = [['a', 1], ['b', 2]] + fig, ax = plt.subplots() + test_fontsize = 20 + t = ax.table(cellText=tableData, loc='top', fontsize=test_fontsize) + cell_fontsize = t[(0, 0)].get_fontsize() + assert cell_fontsize == test_fontsize, f"Actual:{test_fontsize},got:{cell_fontsize}" + cell_fontsize = t[(1, 1)].get_fontsize() + assert cell_fontsize == test_fontsize, f"Actual:{test_fontsize},got:{cell_fontsize}" From 175b148d9dbdda077909d97f34ccefd456c403bb Mon Sep 17 00:00:00 2001 From: Thomas A Caswell Date: Mon, 16 Dec 2024 10:39:07 -0500 Subject: [PATCH 120/131] Backport PR #29323: DOC: Don't put quotes around coordinate system names --- .../users_explain/artists/transforms_tutorial.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/galleries/users_explain/artists/transforms_tutorial.py b/galleries/users_explain/artists/transforms_tutorial.py index 0be5fa3c2e21..f8a3e98e8077 100644 --- a/galleries/users_explain/artists/transforms_tutorial.py +++ b/galleries/users_explain/artists/transforms_tutorial.py @@ -28,37 +28,37 @@ |Coordinate |Description |Transformation object | |system | |from system to display | +================+===================================+=============================+ -|"data" |The coordinate system of the data |``ax.transData`` | +|*data* |The coordinate system of the data |``ax.transData`` | | |in the Axes. | | +----------------+-----------------------------------+-----------------------------+ -|"axes" |The coordinate system of the |``ax.transAxes`` | +|*axes* |The coordinate system of the |``ax.transAxes`` | | |`~matplotlib.axes.Axes`; (0, 0) | | | |is bottom left of the Axes, and | | | |(1, 1) is top right of the Axes. | | +----------------+-----------------------------------+-----------------------------+ -|"subfigure" |The coordinate system of the |``subfigure.transSubfigure`` | +|*subfigure* |The coordinate system of the |``subfigure.transSubfigure`` | | |`.SubFigure`; (0, 0) is bottom left| | | |of the subfigure, and (1, 1) is top| | | |right of the subfigure. If a | | | |figure has no subfigures, this is | | | |the same as ``transFigure``. | | +----------------+-----------------------------------+-----------------------------+ -|"figure" |The coordinate system of the |``fig.transFigure`` | +|*figure* |The coordinate system of the |``fig.transFigure`` | | |`.Figure`; (0, 0) is bottom left | | | |of the figure, and (1, 1) is top | | | |right of the figure. | | +----------------+-----------------------------------+-----------------------------+ -|"figure-inches" |The coordinate system of the |``fig.dpi_scale_trans`` | +|*figure-inches* |The coordinate system of the |``fig.dpi_scale_trans`` | | |`.Figure` in inches; (0, 0) is | | | |bottom left of the figure, and | | | |(width, height) is the top right | | | |of the figure in inches. | | +----------------+-----------------------------------+-----------------------------+ -|"xaxis", |Blended coordinate systems, using |``ax.get_xaxis_transform()``,| -|"yaxis" |data coordinates on one direction |``ax.get_yaxis_transform()`` | +|*xaxis*, |Blended coordinate systems, using |``ax.get_xaxis_transform()``,| +|*yaxis* |data coordinates on one direction |``ax.get_yaxis_transform()`` | | |and axes coordinates on the other. | | +----------------+-----------------------------------+-----------------------------+ -|"display" |The native coordinate system of the|`None`, or | +|*display* |The native coordinate system of the|`None`, or | | |output ; (0, 0) is the bottom left |`.IdentityTransform()` | | |of the window, and (width, height) | | | |is top right of the output in | | From 62726dabafdef1abf0fa62b924c32147ea83737d Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Mon, 16 Dec 2024 18:52:04 -0500 Subject: [PATCH 121/131] Backport PR #29321: DOC: List min. Python version for Matplotlib 3.10 --- doc/devel/min_dep_policy.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/doc/devel/min_dep_policy.rst b/doc/devel/min_dep_policy.rst index 6ff083ca6dc1..e9e18ed391dc 100644 --- a/doc/devel/min_dep_policy.rst +++ b/doc/devel/min_dep_policy.rst @@ -115,6 +115,7 @@ specification of the dependencies. ========== ======== ====== Matplotlib Python NumPy ========== ======== ====== +`3.10`_ 3.10 1.23.0 `3.9`_ 3.9 1.23.0 `3.8`_ 3.9 1.21.0 `3.7`_ 3.8 1.20.0 @@ -136,6 +137,7 @@ Matplotlib Python NumPy 1.0 2.4 1.1 ========== ======== ====== +.. _`3.10`: https://matplotlib.org/3.10.0/devel/dependencies.html .. _`3.9`: https://matplotlib.org/3.9.0/devel/dependencies.html .. _`3.8`: https://matplotlib.org/3.8.0/devel/dependencies.html .. _`3.7`: https://matplotlib.org/3.7.0/devel/dependencies.html From 9ec8fda1176a0b17875fd6715218b34baecf4904 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 17 Dec 2024 13:29:13 +0100 Subject: [PATCH 122/131] Backport PR #29328: Bump github/codeql-action from 3.27.6 to 3.27.9 in the actions group --- .github/workflows/codeql-analysis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 4bf3e680f7b0..089b15700f1b 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -31,7 +31,7 @@ jobs: persist-credentials: false - name: Initialize CodeQL - uses: github/codeql-action/init@aa578102511db1f4524ed59b8cc2bae4f6e88195 # v3.27.6 + uses: github/codeql-action/init@df409f7d9260372bd5f19e5b04e83cb3c43714ae # v3.27.9 with: languages: ${{ matrix.language }} @@ -42,4 +42,4 @@ jobs: pip install --user -v . - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@aa578102511db1f4524ed59b8cc2bae4f6e88195 # v3.27.6 + uses: github/codeql-action/analyze@df409f7d9260372bd5f19e5b04e83cb3c43714ae # v3.27.9 From 5b236d6a977c40d5b16ebc2efc324e65039615b1 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Thu, 19 Dec 2024 17:02:52 -0500 Subject: [PATCH 123/131] Backport PR #29348: DOC: Cleanup scales examples --- galleries/examples/scales/asinh_demo.py | 6 ++--- galleries/examples/scales/log_bar.py | 29 ------------------------- galleries/examples/scales/logit_demo.py | 6 ++--- galleries/examples/scales/scales.py | 6 ++--- 4 files changed, 9 insertions(+), 38 deletions(-) delete mode 100644 galleries/examples/scales/log_bar.py diff --git a/galleries/examples/scales/asinh_demo.py b/galleries/examples/scales/asinh_demo.py index a464d4546ea8..bc8b010c47ce 100644 --- a/galleries/examples/scales/asinh_demo.py +++ b/galleries/examples/scales/asinh_demo.py @@ -1,7 +1,7 @@ """ -============ -Asinh Demo -============ +=========== +Asinh scale +=========== Illustration of the `asinh <.scale.AsinhScale>` axis scaling, which uses the transformation diff --git a/galleries/examples/scales/log_bar.py b/galleries/examples/scales/log_bar.py deleted file mode 100644 index 239069806c5c..000000000000 --- a/galleries/examples/scales/log_bar.py +++ /dev/null @@ -1,29 +0,0 @@ -""" -======= -Log Bar -======= - -Plotting a bar chart with a logarithmic y-axis. -""" -import matplotlib.pyplot as plt -import numpy as np - -data = ((3, 1000), (10, 3), (100, 30), (500, 800), (50, 1)) - -dim = len(data[0]) -w = 0.75 -dimw = w / dim - -fig, ax = plt.subplots() -x = np.arange(len(data)) -for i in range(len(data[0])): - y = [d[i] for d in data] - b = ax.bar(x + i * dimw, y, dimw, bottom=0.001) - -ax.set_xticks(x + dimw / 2, labels=map(str, x)) -ax.set_yscale('log') - -ax.set_xlabel('x') -ax.set_ylabel('y') - -plt.show() diff --git a/galleries/examples/scales/logit_demo.py b/galleries/examples/scales/logit_demo.py index a21abf5b64fb..22a56433ccd7 100644 --- a/galleries/examples/scales/logit_demo.py +++ b/galleries/examples/scales/logit_demo.py @@ -1,7 +1,7 @@ """ -================ -Logit Demo -================ +=========== +Logit scale +=========== Examples of plots with logit axes. """ diff --git a/galleries/examples/scales/scales.py b/galleries/examples/scales/scales.py index 8df4d2fdd4a9..e932609bb7f9 100644 --- a/galleries/examples/scales/scales.py +++ b/galleries/examples/scales/scales.py @@ -1,7 +1,7 @@ """ -====== -Scales -====== +=============== +Scales overview +=============== Illustrate the scale transformations applied to axes, e.g. log, symlog, logit. From 180482a1cdd0f1aac0b4ca348db700e703d44d69 Mon Sep 17 00:00:00 2001 From: Thomas A Caswell Date: Fri, 20 Dec 2024 15:35:33 -0500 Subject: [PATCH 124/131] Backport PR #29355: Add QtCore.Slot() decorations to FigureCanvasQT --- lib/matplotlib/backends/backend_qt.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/matplotlib/backends/backend_qt.py b/lib/matplotlib/backends/backend_qt.py index 432bbb1ffdb6..5cde4866cad7 100644 --- a/lib/matplotlib/backends/backend_qt.py +++ b/lib/matplotlib/backends/backend_qt.py @@ -239,6 +239,7 @@ def __init__(self, figure=None): palette = QtGui.QPalette(QtGui.QColor("white")) self.setPalette(palette) + @QtCore.Slot() def _update_pixel_ratio(self): if self._set_device_pixel_ratio( self.devicePixelRatioF() or 1): # rarely, devicePixelRatioF=0 @@ -248,6 +249,7 @@ def _update_pixel_ratio(self): event = QtGui.QResizeEvent(self.size(), self.size()) self.resizeEvent(event) + @QtCore.Slot(QtGui.QScreen) def _update_screen(self, screen): # Handler for changes to a window's attached screen. self._update_pixel_ratio() From 2c5caa8275be1fd1bf2bb94c1066b06af017ea98 Mon Sep 17 00:00:00 2001 From: Tim Hoffmann <2836374+timhoffm@users.noreply.github.com> Date: Sat, 21 Dec 2024 07:55:29 +0100 Subject: [PATCH 125/131] Backport PR #29364: fix typo --- galleries/users_explain/axes/constrainedlayout_guide.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/galleries/users_explain/axes/constrainedlayout_guide.py b/galleries/users_explain/axes/constrainedlayout_guide.py index d96b829df372..4697d82ba6a6 100644 --- a/galleries/users_explain/axes/constrainedlayout_guide.py +++ b/galleries/users_explain/axes/constrainedlayout_guide.py @@ -532,7 +532,7 @@ def example_plot(ax, fontsize=12, hide_labels=False): example_plot(ax1) example_plot(ax2) example_plot(ax3) -plt.suptitle('Homogenous nrows, ncols') +plt.suptitle('Homogeneous nrows, ncols') # %% # but the following leads to a poor layout: From 86f8906962c5222da405b912c0e0eec135305ea5 Mon Sep 17 00:00:00 2001 From: Tim Hoffmann <2836374+timhoffm@users.noreply.github.com> Date: Sat, 21 Dec 2024 08:03:54 +0100 Subject: [PATCH 126/131] Backport PR #29347: DOC: Explain parameters linthresh and linscale of symlog scale --- galleries/examples/scales/symlog_demo.py | 89 ++++++++++++++++++++++-- 1 file changed, 82 insertions(+), 7 deletions(-) diff --git a/galleries/examples/scales/symlog_demo.py b/galleries/examples/scales/symlog_demo.py index e50be0d0c8a8..47742b853cc9 100644 --- a/galleries/examples/scales/symlog_demo.py +++ b/galleries/examples/scales/symlog_demo.py @@ -1,7 +1,12 @@ """ -=========== -Symlog Demo -=========== +============ +Symlog scale +============ + +The symmetric logarithmic scale is an extension of the logarithmic scale that +also covers negative values. As with the logarithmic scale, it is particularly +useful for numerical data that spans a broad range of values, especially when there +are significant differences between the magnitudes of the numbers involved. Example use of symlog (symmetric log) axis scaling. """ @@ -34,12 +39,82 @@ plt.show() # %% -# It should be noted that the coordinate transform used by ``symlog`` -# has a discontinuous gradient at the transition between its linear -# and logarithmic regions. The ``asinh`` axis scale is an alternative -# technique that may avoid visual artifacts caused by these discontinuities. +# Linear threshold +# ---------------- +# Since each decade on a logarithmic scale covers the same amount of visual space +# and there are infinitely many decades between a given number and zero, the symlog +# scale must deviate from logarithmic mapping in a small range +# *(-linthresh, linthresh)*, so that the range is mapped to a finite visual space. + + +def format_axes(ax, title=None): + """A helper function to better visualize properties of the symlog scale.""" + ax.xaxis.get_minor_locator().set_params(subs=[2, 3, 4, 5, 6, 7, 8, 9]) + ax.grid() + ax.xaxis.grid(which='minor') # minor grid on too + linthresh = ax.xaxis.get_transform().linthresh + linscale = ax.xaxis.get_transform().linscale + ax.axvspan(-linthresh, linthresh, color='0.9') + if title: + ax.set_title(title.format(linthresh=linthresh, linscale=linscale)) + + +x = np.linspace(-60, 60, 201) +y = np.linspace(0, 100.0, 201) + +fig, (ax1, ax2) = plt.subplots(nrows=2, layout="constrained") + +ax1.plot(x, y) +ax1.set_xscale('symlog', linthresh=1) +format_axes(ax1, title='Linear region: linthresh={linthresh}') + +ax2.plot(x, y) +ax2.set_xscale('symlog', linthresh=5) +format_axes(ax2, title='Linear region: linthresh={linthresh}') + +# %% +# Generally, *linthresh* should be chosen so that no or only a few +# data points are in the linear region. As a rule of thumb, +# :math:`linthresh \approx \mathrm{min} |x|`. +# +# +# Linear scale +# ------------ +# Additionally, the *linscale* parameter determines how much visual space should be +# used for the linear range. More precisely, it defines the ratio of visual space +# of the region (0, linthresh) relative to one decade. + +fig, (ax1, ax2) = plt.subplots(nrows=2, layout="constrained") + +ax1.plot(x, y) +ax1.set_xscale('symlog', linthresh=1) +format_axes(ax1, title='Linear region: linthresh={linthresh}, linscale={linscale}') + +ax2.plot(x, y) +ax2.set_xscale('symlog', linthresh=1, linscale=0.1) +format_axes(ax2, title='Linear region: linthresh={linthresh}, linscale={linscale}') # %% +# The suitable value for linscale depends on the dynamic range of data. As most data +# will be outside the linear region, you typically the linear region only to cover +# a small fraction of the visual area. +# +# Limitations and alternatives +# ---------------------------- +# The coordinate transform used by ``symlog`` has a discontinuous gradient at the +# transition between its linear and logarithmic regions. Depending on data and +# scaling, this will be more or less obvious in the plot. + +fig, ax = plt.subplots() +ax.plot(x, y) +ax.set_xscale('symlog', linscale=0.05) +format_axes(ax, title="Discontinuous gradient at linear/log transition") + +# %% +# The ``asinh`` axis scale is an alternative transformation that supports a wide +# dynamic range with a smooth gradient and thus may avoid such visual artifacts. +# See :doc:`/gallery/scales/asinh_demo`. +# # # .. admonition:: References # From f759726c919dfa4f115fae17027d277a751fa8d6 Mon Sep 17 00:00:00 2001 From: Tim Hoffmann <2836374+timhoffm@users.noreply.github.com> Date: Sat, 21 Dec 2024 17:39:55 +0100 Subject: [PATCH 127/131] Backport PR #29362: TYP: semantics of enums in stub files changed --- lib/matplotlib/_enums.py | 28 +++---- lib/matplotlib/_enums.pyi | 21 +++--- lib/matplotlib/backend_bases.pyi | 16 ++-- lib/matplotlib/backend_tools.pyi | 16 ++-- lib/matplotlib/backends/registry.pyi | 4 +- lib/matplotlib/dviread.pyi | 10 +-- lib/matplotlib/ft2font.pyi | 100 ++++++++++++------------- lib/matplotlib/stackplot.pyi | 2 + lib/matplotlib/streamplot.pyi | 2 + lib/matplotlib/style/core.pyi | 2 + lib/matplotlib/ticker.pyi | 11 +++ lib/matplotlib/tri/_triinterpolate.pyi | 2 + 12 files changed, 112 insertions(+), 102 deletions(-) diff --git a/lib/matplotlib/_enums.py b/lib/matplotlib/_enums.py index 773011d36bf6..75a09b7b5d8c 100644 --- a/lib/matplotlib/_enums.py +++ b/lib/matplotlib/_enums.py @@ -10,21 +10,11 @@ they define. """ -from enum import Enum, auto +from enum import Enum from matplotlib import _docstring -class _AutoStringNameEnum(Enum): - """Automate the ``name = 'name'`` part of making a (str, Enum).""" - - def _generate_next_value_(name, start, count, last_values): - return name - - def __hash__(self): - return str(self).__hash__() - - -class JoinStyle(str, _AutoStringNameEnum): +class JoinStyle(str, Enum): """ Define how the connection between two line segments is drawn. @@ -79,9 +69,9 @@ class JoinStyle(str, _AutoStringNameEnum): """ - miter = auto() - round = auto() - bevel = auto() + miter = "miter" + round = "round" + bevel = "bevel" @staticmethod def demo(): @@ -116,7 +106,7 @@ def plot_angle(ax, x, y, angle, style): + "}" -class CapStyle(str, _AutoStringNameEnum): +class CapStyle(str, Enum): r""" Define how the two endpoints (caps) of an unclosed line are drawn. @@ -151,9 +141,9 @@ class CapStyle(str, _AutoStringNameEnum): CapStyle.demo() """ - butt = auto() - projecting = auto() - round = auto() + butt = "butt" + projecting = "projecting" + round = "round" @staticmethod def demo(): diff --git a/lib/matplotlib/_enums.pyi b/lib/matplotlib/_enums.pyi index 351088b36453..714e6cfe03fa 100644 --- a/lib/matplotlib/_enums.pyi +++ b/lib/matplotlib/_enums.pyi @@ -1,18 +1,19 @@ +from typing import cast from enum import Enum -class _AutoStringNameEnum(Enum): - def __hash__(self) -> int: ... -class JoinStyle(str, _AutoStringNameEnum): - miter: str - round: str - bevel: str +class JoinStyle(str, Enum): + miter = "miter" + round = "round" + bevel = "bevel" @staticmethod def demo() -> None: ... -class CapStyle(str, _AutoStringNameEnum): - butt: str - projecting: str - round: str + +class CapStyle(str, Enum): + butt = "butt" + projecting = "projecting" + round = "round" + @staticmethod def demo() -> None: ... diff --git a/lib/matplotlib/backend_bases.pyi b/lib/matplotlib/backend_bases.pyi index 8089bb49e597..23a19b79d3be 100644 --- a/lib/matplotlib/backend_bases.pyi +++ b/lib/matplotlib/backend_bases.pyi @@ -236,11 +236,11 @@ class LocationEvent(Event): ) -> None: ... class MouseButton(IntEnum): - LEFT: int - MIDDLE: int - RIGHT: int - BACK: int - FORWARD: int + LEFT = 1 + MIDDLE = 2 + RIGHT = 3 + BACK = 8 + FORWARD = 9 class MouseEvent(LocationEvent): button: MouseButton | Literal["up", "down"] | None @@ -398,9 +398,9 @@ class FigureManagerBase: cursors = Cursors class _Mode(str, Enum): - NONE: str - PAN: str - ZOOM: str + NONE = "" + PAN = "pan/zoom" + ZOOM = "zoom rect" class NavigationToolbar2: toolitems: tuple[tuple[str, ...] | tuple[None, ...], ...] diff --git a/lib/matplotlib/backend_tools.pyi b/lib/matplotlib/backend_tools.pyi index f86a207c7545..32fe8c2f5a79 100644 --- a/lib/matplotlib/backend_tools.pyi +++ b/lib/matplotlib/backend_tools.pyi @@ -6,16 +6,16 @@ from matplotlib.backend_managers import ToolManager, ToolEvent from matplotlib.figure import Figure from matplotlib.scale import ScaleBase -from typing import Any +from typing import Any, cast class Cursors(enum.IntEnum): - POINTER: int - HAND: int - SELECT_REGION: int - MOVE: int - WAIT: int - RESIZE_HORIZONTAL: int - RESIZE_VERTICAL: int + POINTER = cast(int, ...) + HAND = cast(int, ...) + SELECT_REGION = cast(int, ...) + MOVE = cast(int, ...) + WAIT = cast(int, ...) + RESIZE_HORIZONTAL = cast(int, ...) + RESIZE_VERTICAL = cast(int, ...) cursors = Cursors diff --git a/lib/matplotlib/backends/registry.pyi b/lib/matplotlib/backends/registry.pyi index e1ae5b3e7d3a..565f044bf212 100644 --- a/lib/matplotlib/backends/registry.pyi +++ b/lib/matplotlib/backends/registry.pyi @@ -3,8 +3,8 @@ from types import ModuleType class BackendFilter(Enum): - INTERACTIVE: int - NON_INTERACTIVE: int + INTERACTIVE = 0 + NON_INTERACTIVE = 1 class BackendRegistry: diff --git a/lib/matplotlib/dviread.pyi b/lib/matplotlib/dviread.pyi index 270818278f17..8073ee9fbff8 100644 --- a/lib/matplotlib/dviread.pyi +++ b/lib/matplotlib/dviread.pyi @@ -8,11 +8,11 @@ from typing import NamedTuple from typing_extensions import Self # < Py 3.11 class _dvistate(Enum): - pre: int - outer: int - inpage: int - post_post: int - finale: int + pre = ... + outer = ... + inpage = ... + post_post = ... + finale = ... class Page(NamedTuple): text: list[Text] diff --git a/lib/matplotlib/ft2font.pyi b/lib/matplotlib/ft2font.pyi index 1638bac692d3..811f82f95963 100644 --- a/lib/matplotlib/ft2font.pyi +++ b/lib/matplotlib/ft2font.pyi @@ -1,6 +1,6 @@ from enum import Enum, Flag import sys -from typing import BinaryIO, Literal, TypedDict, final, overload +from typing import BinaryIO, Literal, TypedDict, final, overload, cast from typing_extensions import Buffer # < Py 3.12 import numpy as np @@ -10,62 +10,62 @@ __freetype_build_type__: str __freetype_version__: str class FaceFlags(Flag): - SCALABLE: int - FIXED_SIZES: int - FIXED_WIDTH: int - SFNT: int - HORIZONTAL: int - VERTICAL: int - KERNING: int - FAST_GLYPHS: int - MULTIPLE_MASTERS: int - GLYPH_NAMES: int - EXTERNAL_STREAM: int - HINTER: int - CID_KEYED: int - TRICKY: int - COLOR: int - # VARIATION: int # FT 2.9 - # SVG: int # FT 2.12 - # SBIX: int # FT 2.12 - # SBIX_OVERLAY: int # FT 2.12 + SCALABLE = cast(int, ...) + FIXED_SIZES = cast(int, ...) + FIXED_WIDTH = cast(int, ...) + SFNT = cast(int, ...) + HORIZONTAL = cast(int, ...) + VERTICAL = cast(int, ...) + KERNING = cast(int, ...) + FAST_GLYPHS = cast(int, ...) + MULTIPLE_MASTERS = cast(int, ...) + GLYPH_NAMES = cast(int, ...) + EXTERNAL_STREAM = cast(int, ...) + HINTER = cast(int, ...) + CID_KEYED = cast(int, ...) + TRICKY = cast(int, ...) + COLOR = cast(int, ...) + # VARIATION = cast(int, ...) # FT 2.9 + # SVG = cast(int, ...) # FT 2.12 + # SBIX = cast(int, ...) # FT 2.12 + # SBIX_OVERLAY = cast(int, ...) # FT 2.12 class Kerning(Enum): - DEFAULT: int - UNFITTED: int - UNSCALED: int + DEFAULT = cast(int, ...) + UNFITTED = cast(int, ...) + UNSCALED = cast(int, ...) class LoadFlags(Flag): - DEFAULT: int - NO_SCALE: int - NO_HINTING: int - RENDER: int - NO_BITMAP: int - VERTICAL_LAYOUT: int - FORCE_AUTOHINT: int - CROP_BITMAP: int - PEDANTIC: int - IGNORE_GLOBAL_ADVANCE_WIDTH: int - NO_RECURSE: int - IGNORE_TRANSFORM: int - MONOCHROME: int - LINEAR_DESIGN: int - NO_AUTOHINT: int - COLOR: int - COMPUTE_METRICS: int # FT 2.6.1 - # BITMAP_METRICS_ONLY: int # FT 2.7.1 - # NO_SVG: int # FT 2.13.1 + DEFAULT = cast(int, ...) + NO_SCALE = cast(int, ...) + NO_HINTING = cast(int, ...) + RENDER = cast(int, ...) + NO_BITMAP = cast(int, ...) + VERTICAL_LAYOUT = cast(int, ...) + FORCE_AUTOHINT = cast(int, ...) + CROP_BITMAP = cast(int, ...) + PEDANTIC = cast(int, ...) + IGNORE_GLOBAL_ADVANCE_WIDTH = cast(int, ...) + NO_RECURSE = cast(int, ...) + IGNORE_TRANSFORM = cast(int, ...) + MONOCHROME = cast(int, ...) + LINEAR_DESIGN = cast(int, ...) + NO_AUTOHINT = cast(int, ...) + COLOR = cast(int, ...) + COMPUTE_METRICS = cast(int, ...) # FT 2.6.1 + # BITMAP_METRICS_ONLY = cast(int, ...) # FT 2.7.1 + # NO_SVG = cast(int, ...) # FT 2.13.1 # The following should be unique, but the above can be OR'd together. - TARGET_NORMAL: int - TARGET_LIGHT: int - TARGET_MONO: int - TARGET_LCD: int - TARGET_LCD_V: int + TARGET_NORMAL = cast(int, ...) + TARGET_LIGHT = cast(int, ...) + TARGET_MONO = cast(int, ...) + TARGET_LCD = cast(int, ...) + TARGET_LCD_V = cast(int, ...) class StyleFlags(Flag): - NORMAL: int - ITALIC: int - BOLD: int + NORMAL = cast(int, ...) + ITALIC = cast(int, ...) + BOLD = cast(int, ...) class _SfntHeadDict(TypedDict): version: tuple[int, int] diff --git a/lib/matplotlib/stackplot.pyi b/lib/matplotlib/stackplot.pyi index 2981d449b566..9509f858a4bf 100644 --- a/lib/matplotlib/stackplot.pyi +++ b/lib/matplotlib/stackplot.pyi @@ -16,3 +16,5 @@ def stackplot( baseline: Literal["zero", "sym", "wiggle", "weighted_wiggle"] = ..., **kwargs ) -> list[PolyCollection]: ... + +__all__ = ['stackplot'] diff --git a/lib/matplotlib/streamplot.pyi b/lib/matplotlib/streamplot.pyi index 9da83096e5a8..be7458020449 100644 --- a/lib/matplotlib/streamplot.pyi +++ b/lib/matplotlib/streamplot.pyi @@ -80,3 +80,5 @@ class StreamMask: class InvalidIndexError(Exception): ... class TerminateTrajectory(Exception): ... class OutOfBounds(IndexError): ... + +__all__ = ['streamplot'] diff --git a/lib/matplotlib/style/core.pyi b/lib/matplotlib/style/core.pyi index 73400492143c..5734b017f7c4 100644 --- a/lib/matplotlib/style/core.pyi +++ b/lib/matplotlib/style/core.pyi @@ -17,3 +17,5 @@ library: dict[str, RcParams] available: list[str] def reload_library() -> None: ... + +__all__ = ['use', 'context', 'available', 'library', 'reload_library'] diff --git a/lib/matplotlib/ticker.pyi b/lib/matplotlib/ticker.pyi index f990bf53ca42..bed288658909 100644 --- a/lib/matplotlib/ticker.pyi +++ b/lib/matplotlib/ticker.pyi @@ -295,3 +295,14 @@ class AutoLocator(MaxNLocator): class AutoMinorLocator(Locator): ndivs: int def __init__(self, n: int | None = ...) -> None: ... + +__all__ = ('TickHelper', 'Formatter', 'FixedFormatter', + 'NullFormatter', 'FuncFormatter', 'FormatStrFormatter', + 'StrMethodFormatter', 'ScalarFormatter', 'LogFormatter', + 'LogFormatterExponent', 'LogFormatterMathtext', + 'LogFormatterSciNotation', + 'LogitFormatter', 'EngFormatter', 'PercentFormatter', + 'Locator', 'IndexLocator', 'FixedLocator', 'NullLocator', + 'LinearLocator', 'LogLocator', 'AutoLocator', + 'MultipleLocator', 'MaxNLocator', 'AutoMinorLocator', + 'SymmetricalLogLocator', 'AsinhLocator', 'LogitLocator') diff --git a/lib/matplotlib/tri/_triinterpolate.pyi b/lib/matplotlib/tri/_triinterpolate.pyi index 8a56b22acdb2..33b2fd8be4cd 100644 --- a/lib/matplotlib/tri/_triinterpolate.pyi +++ b/lib/matplotlib/tri/_triinterpolate.pyi @@ -28,3 +28,5 @@ class CubicTriInterpolator(TriInterpolator): trifinder: TriFinder | None = ..., dz: tuple[ArrayLike, ArrayLike] | None = ..., ) -> None: ... + +__all__ = ('TriInterpolator', 'LinearTriInterpolator', 'CubicTriInterpolator') From 8cb736d254f4c57ab700c162c329a8c5c4cef1c6 Mon Sep 17 00:00:00 2001 From: Tim Hoffmann <2836374+timhoffm@users.noreply.github.com> Date: Sun, 22 Dec 2024 00:23:15 +0100 Subject: [PATCH 128/131] Backport PR #29353: DOC: Improve module docs of matplotlib.scale --- doc/api/scale_api.rst | 1 + lib/matplotlib/scale.py | 33 +++++++++++++++++++++++++-------- 2 files changed, 26 insertions(+), 8 deletions(-) diff --git a/doc/api/scale_api.rst b/doc/api/scale_api.rst index 1eb890dcfb48..623fbdd0392f 100644 --- a/doc/api/scale_api.rst +++ b/doc/api/scale_api.rst @@ -6,3 +6,4 @@ :members: :undoc-members: :show-inheritance: + :member-order: bysource diff --git a/lib/matplotlib/scale.py b/lib/matplotlib/scale.py index ccaaae6caf5d..a63294406b56 100644 --- a/lib/matplotlib/scale.py +++ b/lib/matplotlib/scale.py @@ -1,16 +1,31 @@ """ Scales define the distribution of data values on an axis, e.g. a log scaling. -They are defined as subclasses of `ScaleBase`. -See also `.axes.Axes.set_xscale` and the scales examples in the documentation. +The mapping is implemented through `.Transform` subclasses. -See :doc:`/gallery/scales/custom_scale` for a full example of defining a custom -scale. +The following scales are builtin: -Matplotlib also supports non-separable transformations that operate on both -`~.axis.Axis` at the same time. They are known as projections, and defined in -`matplotlib.projections`. -""" +============= ===================== ================================ ================================= +Name Class Transform Inverted transform +============= ===================== ================================ ================================= +"asinh" `AsinhScale` `AsinhTransform` `InvertedAsinhTransform` +"function" `FuncScale` `FuncTransform` `FuncTransform` +"functionlog" `FuncScaleLog` `FuncTransform` + `LogTransform` `InvertedLogTransform` + `FuncTransform` +"linear" `LinearScale` `.IdentityTransform` `.IdentityTransform` +"log" `LogScale` `LogTransform` `InvertedLogTransform` +"logit" `LogitScale` `LogitTransform` `LogisticTransform` +"symlog" `SymmetricalLogScale` `SymmetricalLogTransform` `InvertedSymmetricalLogTransform` +============= ===================== ================================ ================================= + +A user will often only use the scale name, e.g. when setting the scale through +`~.Axes.set_xscale`: ``ax.set_xscale("log")``. + +See also the :ref:`scales examples ` in the documentation. + +Custom scaling can be achieved through `FuncScale`, or by creating your own +`ScaleBase` subclass and corresponding transforms (see :doc:`/gallery/scales/custom_scale`). +Third parties can register their scales by name through `register_scale`. +""" # noqa: E501 import inspect import textwrap @@ -412,6 +427,8 @@ class SymmetricalLogScale(ScaleBase): *linthresh* allows the user to specify the size of this range (-*linthresh*, *linthresh*). + See :doc:`/gallery/scales/symlog_demo` for a detailed description. + Parameters ---------- base : float, default: 10 From f8d391631669bcaa4beac5b1b4c5d3551c031807 Mon Sep 17 00:00:00 2001 From: Tim Hoffmann <2836374+timhoffm@users.noreply.github.com> Date: Mon, 30 Dec 2024 19:22:34 +0100 Subject: [PATCH 129/131] Backport PR #29389: DOC: Minor improvements on VPacker, HPacker, PaddedBox docs --- lib/matplotlib/offsetbox.py | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/lib/matplotlib/offsetbox.py b/lib/matplotlib/offsetbox.py index 49f0946f1ee9..8dd5f4ec23c1 100644 --- a/lib/matplotlib/offsetbox.py +++ b/lib/matplotlib/offsetbox.py @@ -436,6 +436,14 @@ class VPacker(PackerBase): """ VPacker packs its children vertically, automatically adjusting their relative positions at draw time. + + .. code-block:: none + + +---------+ + | Child 1 | + | Child 2 | + | Child 3 | + +---------+ """ def _get_bbox_and_child_offsets(self, renderer): @@ -468,6 +476,12 @@ class HPacker(PackerBase): """ HPacker packs its children horizontally, automatically adjusting their relative positions at draw time. + + .. code-block:: none + + +-------------------------------+ + | Child 1 Child 2 Child 3 | + +-------------------------------+ """ def _get_bbox_and_child_offsets(self, renderer): @@ -498,6 +512,26 @@ class PaddedBox(OffsetBox): The `.PaddedBox` contains a `.FancyBboxPatch` that is used to visualize it when rendering. + + .. code-block:: none + + +----------------------------+ + | | + | | + | | + | <--pad--> Artist | + | ^ | + | pad | + | v | + +----------------------------+ + + Attributes + ---------- + pad : float + The padding in points. + patch : `.FancyBboxPatch` + When *draw_frame* is True, this `.FancyBboxPatch` is made visible and + creates a border around the box. """ def __init__(self, child, pad=0., *, draw_frame=False, patch_attrs=None): From c94a469000f81ff5b1e0ca576c284cc2bb9fd8d5 Mon Sep 17 00:00:00 2001 From: Scott Shambaugh <14363975+scottshambaugh@users.noreply.github.com> Date: Sun, 5 Jan 2025 17:17:19 -0700 Subject: [PATCH 130/131] Backport PR #29401: FIX: add errorbars with `add_container` --- lib/matplotlib/axes/_axes.py | 2 +- lib/matplotlib/tests/test_axes.py | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/lib/matplotlib/axes/_axes.py b/lib/matplotlib/axes/_axes.py index 679499a4eab3..87e9401bb294 100644 --- a/lib/matplotlib/axes/_axes.py +++ b/lib/matplotlib/axes/_axes.py @@ -3861,7 +3861,7 @@ def apply_mask(arrays, mask): (data_line, tuple(caplines), tuple(barcols)), has_xerr=(xerr is not None), has_yerr=(yerr is not None), label=label) - self.containers.append(errorbar_container) + self.add_container(errorbar_container) return errorbar_container # (l0, caplines, barcols) diff --git a/lib/matplotlib/tests/test_axes.py b/lib/matplotlib/tests/test_axes.py index e9218bc82573..618e8462c340 100644 --- a/lib/matplotlib/tests/test_axes.py +++ b/lib/matplotlib/tests/test_axes.py @@ -4225,6 +4225,24 @@ def test_errorbar_nonefmt(): assert np.all(errbar.get_color() == mcolors.to_rgba('C0')) +def test_errorbar_remove(): + x = np.arange(5) + y = np.arange(5) + + fig, ax = plt.subplots() + ec = ax.errorbar(x, y, xerr=1, yerr=1) + + assert len(ax.containers) == 1 + assert len(ax.lines) == 5 + assert len(ax.collections) == 2 + + ec.remove() + + assert not ax.containers + assert not ax.lines + assert not ax.collections + + def test_errorbar_line_specific_kwargs(): # Check that passing line-specific keyword arguments will not result in # errors. From 462555c3eb0d8320f17b0492ecfe73662bb458bd Mon Sep 17 00:00:00 2001 From: Greg Lucas Date: Mon, 6 Jan 2025 09:12:28 -0700 Subject: [PATCH 131/131] Backport PR #29363: FIX: Add version gate to GTK4 calls when necessary --- lib/matplotlib/backends/backend_gtk4.py | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/lib/matplotlib/backends/backend_gtk4.py b/lib/matplotlib/backends/backend_gtk4.py index 6af301c2becb..620c9e5b94b6 100644 --- a/lib/matplotlib/backends/backend_gtk4.py +++ b/lib/matplotlib/backends/backend_gtk4.py @@ -29,6 +29,8 @@ TimerGTK as TimerGTK4, ) +_GOBJECT_GE_3_47 = gi.version_info >= (3, 47, 0) + class FigureCanvasGTK4(_FigureCanvasGTK, Gtk.DrawingArea): required_interactive_framework = "gtk4" @@ -115,7 +117,7 @@ def scroll_event(self, controller, dx, dy): MouseEvent( "scroll_event", self, *self._mpl_coords(), step=dy, modifiers=self._mpl_modifiers(controller), - guiEvent=controller.get_current_event(), + guiEvent=controller.get_current_event() if _GOBJECT_GE_3_47 else None, )._process() return True @@ -124,7 +126,7 @@ def button_press_event(self, controller, n_press, x, y): "button_press_event", self, *self._mpl_coords((x, y)), controller.get_current_button(), modifiers=self._mpl_modifiers(controller), - guiEvent=controller.get_current_event(), + guiEvent=controller.get_current_event() if _GOBJECT_GE_3_47 else None, )._process() self.grab_focus() @@ -133,14 +135,14 @@ def button_release_event(self, controller, n_press, x, y): "button_release_event", self, *self._mpl_coords((x, y)), controller.get_current_button(), modifiers=self._mpl_modifiers(controller), - guiEvent=controller.get_current_event(), + guiEvent=controller.get_current_event() if _GOBJECT_GE_3_47 else None, )._process() def key_press_event(self, controller, keyval, keycode, state): KeyEvent( "key_press_event", self, self._get_key(keyval, keycode, state), *self._mpl_coords(), - guiEvent=controller.get_current_event(), + guiEvent=controller.get_current_event() if _GOBJECT_GE_3_47 else None, )._process() return True @@ -148,7 +150,7 @@ def key_release_event(self, controller, keyval, keycode, state): KeyEvent( "key_release_event", self, self._get_key(keyval, keycode, state), *self._mpl_coords(), - guiEvent=controller.get_current_event(), + guiEvent=controller.get_current_event() if _GOBJECT_GE_3_47 else None, )._process() return True @@ -157,21 +159,21 @@ def motion_notify_event(self, controller, x, y): "motion_notify_event", self, *self._mpl_coords((x, y)), buttons=self._mpl_buttons(controller), modifiers=self._mpl_modifiers(controller), - guiEvent=controller.get_current_event(), + guiEvent=controller.get_current_event() if _GOBJECT_GE_3_47 else None, )._process() def enter_notify_event(self, controller, x, y): LocationEvent( "figure_enter_event", self, *self._mpl_coords((x, y)), modifiers=self._mpl_modifiers(), - guiEvent=controller.get_current_event(), + guiEvent=controller.get_current_event() if _GOBJECT_GE_3_47 else None, )._process() def leave_notify_event(self, controller): LocationEvent( "figure_leave_event", self, *self._mpl_coords(), modifiers=self._mpl_modifiers(), - guiEvent=controller.get_current_event(), + guiEvent=controller.get_current_event() if _GOBJECT_GE_3_47 else None, )._process() def resize_event(self, area, width, height):