From 4915f574b80c307e77770b1b0961f1b1eaeba630 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Wed, 5 Jul 2023 20:09:45 -0400 Subject: [PATCH 1/7] DOC: Add Zenodo DOI for 3.7.2 --- doc/_static/zenodo_cache/8118151.svg | 35 ++++++++++++++++++++++++++++ doc/users/project/citing.rst | 3 +++ tools/cache_zenodo_svg.py | 1 + 3 files changed, 39 insertions(+) create mode 100644 doc/_static/zenodo_cache/8118151.svg diff --git a/doc/_static/zenodo_cache/8118151.svg b/doc/_static/zenodo_cache/8118151.svg new file mode 100644 index 000000000000..e9d33ec5bf34 --- /dev/null +++ b/doc/_static/zenodo_cache/8118151.svg @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + + + DOI + + + DOI + + + 10.5281/zenodo.8118151 + + + 10.5281/zenodo.8118151 + + + \ No newline at end of file diff --git a/doc/users/project/citing.rst b/doc/users/project/citing.rst index b0491cf05e42..89b9b5193784 100644 --- a/doc/users/project/citing.rst +++ b/doc/users/project/citing.rst @@ -29,6 +29,9 @@ By version .. START OF AUTOGENERATED +v3.7.2 + .. image:: ../../_static/zenodo_cache/8118151.svg + :target: https://doi.org/10.5281/zenodo.8118151 v3.7.1 .. image:: ../../_static/zenodo_cache/7697899.svg :target: https://doi.org/10.5281/zenodo.7697899 diff --git a/tools/cache_zenodo_svg.py b/tools/cache_zenodo_svg.py index b644192dd990..6cc9be01078e 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.7.2": "8118151", "v3.7.1": "7697899", "v3.7.0": "7637593", "v3.6.3": "7527665", From febab954d6d39a3b25261a72ff1c0b238af4b881 Mon Sep 17 00:00:00 2001 From: hannah Date: Wed, 5 Jul 2023 21:47:35 -0400 Subject: [PATCH 2/7] Backport PR #26266: DOC: Use consistent font for anatomy example --- examples/showcase/anatomy.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/showcase/anatomy.py b/examples/showcase/anatomy.py index f53aa2bb9d9e..c8c4fab6e721 100644 --- a/examples/showcase/anatomy.py +++ b/examples/showcase/anatomy.py @@ -71,7 +71,7 @@ def annotate(x, y, text, code): color = 'white' if path_effects else royal_blue ax.text(x, y-0.2, text, zorder=100, ha='center', va='top', weight='bold', color=color, - style='italic', fontfamily='Courier New', + style='italic', fontfamily='monospace', path_effects=path_effects) color = 'white' if path_effects else 'black' From 6899ea8db0d05793780879d1e1c5e86d1efa4d6c Mon Sep 17 00:00:00 2001 From: Kyle Sunden Date: Wed, 12 Jul 2023 10:58:56 -0500 Subject: [PATCH 3/7] Backport PR #26195: [Doc] link style sheets reference to customization tutorial --- doc/api/style_api.rst | 6 +++--- examples/style_sheets/style_sheets_reference.py | 13 ++++++++++++- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/doc/api/style_api.rst b/doc/api/style_api.rst index 84bbe8b25c84..08d8d5ec1c4d 100644 --- a/doc/api/style_api.rst +++ b/doc/api/style_api.rst @@ -20,13 +20,13 @@ the builtin styles. .. imported variables have to be specified explicitly due to https://github.com/sphinx-doc/sphinx/issues/6607 -.. data:: matplotlib.style.library +.. data:: library - A dict mapping from style name to `.RcParams` defining that style. + A dict mapping from style name to `.rcParams` defining that style. This is meant to be read-only. Use `.reload_library` to update. -.. data:: matplotlib.style.available +.. data:: available List of the names of the available styles. diff --git a/examples/style_sheets/style_sheets_reference.py b/examples/style_sheets/style_sheets_reference.py index 8557cc10a203..49667e6996d5 100644 --- a/examples/style_sheets/style_sheets_reference.py +++ b/examples/style_sheets/style_sheets_reference.py @@ -5,8 +5,19 @@ This script demonstrates the different available style sheets on a common set of example plots: scatter plot, image, bar graph, patches, -line plot and histogram, +line plot and histogram. +Any of these style sheets can be imported (i.e. activated) by its name. +For example for the ggplot style: + +>>> plt.style.use('ggplot') + +The names of the available style sheets can be found +in the list `matplotlib.style.available` +(they are also printed in the corner of each plot below). + +See more details in :ref:`Customizing Matplotlib +using style sheets`. """ import numpy as np From 9fea6034a54671c565a7617b9ce62c06cd97510e Mon Sep 17 00:00:00 2001 From: Oscar Gustafsson Date: Sun, 16 Jul 2023 17:17:11 +0900 Subject: [PATCH 4/7] Backport PR #26321: remove quote box from font_manager --- doc/api/font_manager_api.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/api/font_manager_api.rst b/doc/api/font_manager_api.rst index 3e043112380b..ba1d785ca939 100644 --- a/doc/api/font_manager_api.rst +++ b/doc/api/font_manager_api.rst @@ -7,9 +7,9 @@ :undoc-members: :show-inheritance: - .. data:: fontManager +.. data:: fontManager - The global instance of `FontManager`. + The global instance of `FontManager`. .. autoclass:: FontEntry :no-undoc-members: From 48986b9c294b1a58510d566aab8d3084335af933 Mon Sep 17 00:00:00 2001 From: hannah Date: Tue, 25 Jul 2023 15:14:26 -0400 Subject: [PATCH 5/7] Backport PR #26370: Update README.txt --- examples/README.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/examples/README.txt b/examples/README.txt index 8e41fb83d300..bab703b4168e 100644 --- a/examples/README.txt +++ b/examples/README.txt @@ -1,3 +1,4 @@ + .. _examples-index: .. _gallery: @@ -5,6 +6,7 @@ ======== Examples ======== +For an overview of the plotting methods we provide, see :ref:`plot_types` This page contains example plots. Click on any image to see the full image and source code. From 372002bd1de476d6ca9ef225eff54a25ae766958 Mon Sep 17 00:00:00 2001 From: hannah Date: Sat, 29 Jul 2023 21:40:07 -0400 Subject: [PATCH 6/7] Backport PR #26405: DOC: Clarify the difference between document and section references --- doc/devel/documenting_mpl.rst | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/doc/devel/documenting_mpl.rst b/doc/devel/documenting_mpl.rst index b814e67cd308..ad9ba885a3f4 100644 --- a/doc/devel/documenting_mpl.rst +++ b/doc/devel/documenting_mpl.rst @@ -187,9 +187,24 @@ nor the ````literal```` role: Referring to other documents and sections ----------------------------------------- -Sphinx_ allows internal references_ between documents. +Sphinx_ supports internal references_: -Documents can be linked with the ``:doc:`` directive: +========== =============== =========================================== +Role Links target Representation in rendered HTML +========== =============== =========================================== +|doc-dir|_ document link to a page +|ref-dir|_ reference label link to an anchor associated with a heading +========== =============== =========================================== + +.. The following is a hack to have a link with literal formatting + See https://stackoverflow.com/a/4836544 + +.. |doc-dir| replace:: ``:doc:`` +.. _doc-dir: https://www.sphinx-doc.org/en/master/usage/restructuredtext/roles.html#role-doc +.. |ref-dir| replace:: ``:ref:`` +.. _ref-dir: https://www.sphinx-doc.org/en/master/usage/restructuredtext/roles.html#role-ref + +Examples: .. code-block:: rst @@ -207,7 +222,7 @@ will render as: See the example :doc:`/gallery/lines_bars_and_markers/simple_plot` -Sections can also be given reference names. For instance from the +Sections can also be given reference labels. For instance from the :doc:`/users/installing/index` link: .. code-block:: rst From d80c9ce6c3a713cb5ca29b5ce289f0360c59557b Mon Sep 17 00:00:00 2001 From: Oscar Gustafsson Date: Sun, 30 Jul 2023 19:14:44 +0200 Subject: [PATCH 7/7] Backport PR #26414: Fixes for pycodestyle v2.11 (cherry picked from commit f7a8cabc1cf1ac9b35502f08e764d74d07d865ac) --- examples/misc/packed_bubbles.py | 3 +-- lib/matplotlib/dviread.py | 2 +- lib/matplotlib/font_manager.py | 2 +- lib/matplotlib/tests/test_axes.py | 4 ++-- lib/matplotlib/tests/test_cbook.py | 6 +++--- lib/matplotlib/tests/test_image.py | 2 +- lib/matplotlib/tests/test_scale.py | 8 ++++---- 7 files changed, 13 insertions(+), 14 deletions(-) diff --git a/examples/misc/packed_bubbles.py b/examples/misc/packed_bubbles.py index 12f51e9569cb..65ec206899ab 100644 --- a/examples/misc/packed_bubbles.py +++ b/examples/misc/packed_bubbles.py @@ -76,8 +76,7 @@ def check_collisions(self, bubble, bubbles): def collides_with(self, bubble, bubbles): distance = self.outline_distance(bubble, bubbles) - idx_min = np.argmin(distance) - return idx_min if type(idx_min) == np.ndarray else [idx_min] + return np.argmin(distance, keepdims=True) def collapse(self, n_iterations=50): """ diff --git a/lib/matplotlib/dviread.py b/lib/matplotlib/dviread.py index cbd3b542a003..a37a60613903 100644 --- a/lib/matplotlib/dviread.py +++ b/lib/matplotlib/dviread.py @@ -622,7 +622,7 @@ def __init__(self, scale, tfm, texname, vf): for char in range(nchars)] def __eq__(self, other): - return (type(self) == type(other) + return (type(self) is type(other) and self.texname == other.texname and self.size == other.size) def __ne__(self, other): diff --git a/lib/matplotlib/font_manager.py b/lib/matplotlib/font_manager.py index 7f958089f3e4..e570add89271 100644 --- a/lib/matplotlib/font_manager.py +++ b/lib/matplotlib/font_manager.py @@ -851,7 +851,7 @@ def set_fontconfig_pattern(self, pattern): pattern syntax for use here. """ for key, val in parse_fontconfig_pattern(pattern).items(): - if type(val) == list: + if type(val) is list: getattr(self, "set_" + key)(val[0]) else: getattr(self, "set_" + key)(val) diff --git a/lib/matplotlib/tests/test_axes.py b/lib/matplotlib/tests/test_axes.py index cef1c76af666..cf33d31c6f77 100644 --- a/lib/matplotlib/tests/test_axes.py +++ b/lib/matplotlib/tests/test_axes.py @@ -2834,12 +2834,12 @@ def _as_mpl_axes(self): # testing axes creation with plt.axes ax = plt.axes([0, 0, 1, 1], projection=prj) - assert type(ax) == PolarAxes + assert type(ax) is PolarAxes plt.close() # testing axes creation with subplot ax = plt.subplot(121, projection=prj) - assert type(ax) == PolarAxes + assert type(ax) is PolarAxes plt.close() diff --git a/lib/matplotlib/tests/test_cbook.py b/lib/matplotlib/tests/test_cbook.py index 3a70358e2530..39868e5dcb8b 100644 --- a/lib/matplotlib/tests/test_cbook.py +++ b/lib/matplotlib/tests/test_cbook.py @@ -224,7 +224,7 @@ def test_callback_complete(self, pickle): # test that we can add a callback cid1 = self.connect(self.signal, mini_me.dummy, pickle) - assert type(cid1) == int + assert type(cid1) is int self.is_not_empty() # test that we don't add a second callback @@ -249,7 +249,7 @@ def test_callback_disconnect(self, pickle): # test that we can add a callback cid1 = self.connect(self.signal, mini_me.dummy, pickle) - assert type(cid1) == int + assert type(cid1) is int self.is_not_empty() self.disconnect(cid1) @@ -267,7 +267,7 @@ def test_callback_wrong_disconnect(self, pickle): # test that we can add a callback cid1 = self.connect(self.signal, mini_me.dummy, pickle) - assert type(cid1) == int + assert type(cid1) is int self.is_not_empty() self.disconnect("foo") diff --git a/lib/matplotlib/tests/test_image.py b/lib/matplotlib/tests/test_image.py index 2860a558d83e..9198c2b91994 100644 --- a/lib/matplotlib/tests/test_image.py +++ b/lib/matplotlib/tests/test_image.py @@ -1461,6 +1461,6 @@ def test_str_norms(fig_test, fig_ref): axrs[3].imshow(t, norm=colors.SymLogNorm(linthresh=2, vmin=.3, vmax=.7)) axrs[4].imshow(t, norm="logit", clim=(.3, .7)) - assert type(axts[0].images[0].norm) == colors.LogNorm # Exactly that class + assert type(axts[0].images[0].norm) is colors.LogNorm # Exactly that class with pytest.raises(ValueError): axts[0].imshow(t, norm="foobar") diff --git a/lib/matplotlib/tests/test_scale.py b/lib/matplotlib/tests/test_scale.py index 7f1130560581..727397367762 100644 --- a/lib/matplotlib/tests/test_scale.py +++ b/lib/matplotlib/tests/test_scale.py @@ -37,22 +37,22 @@ def test_symlog_mask_nan(): x = np.arange(-1.5, 5, 0.5) out = slti.transform_non_affine(slt.transform_non_affine(x)) assert_allclose(out, x) - assert type(out) == type(x) + assert type(out) is type(x) x[4] = np.nan out = slti.transform_non_affine(slt.transform_non_affine(x)) assert_allclose(out, x) - assert type(out) == type(x) + assert type(out) is type(x) x = np.ma.array(x) out = slti.transform_non_affine(slt.transform_non_affine(x)) assert_allclose(out, x) - assert type(out) == type(x) + assert type(out) is type(x) x[3] = np.ma.masked out = slti.transform_non_affine(slt.transform_non_affine(x)) assert_allclose(out, x) - assert type(out) == type(x) + assert type(out) is type(x) @image_comparison(['logit_scales.png'], remove_text=True)