diff --git a/.github/workflows/cibuildsdist.yml b/.github/workflows/cibuildsdist.yml index d583fe1cfbcb..39b2790630d6 100644 --- a/.github/workflows/cibuildsdist.yml +++ b/.github/workflows/cibuildsdist.yml @@ -28,9 +28,9 @@ jobs: github.event_name == 'pull_request' && ( ( github.event.action == 'labeled' && - github.event.label.name == 'Run cibuildwheel' + github.event.label.name == 'CI: Run cibuildwheel' ) || - contains(github.event.pull_request.labels.*.name, 'Run cibuildwheel') + contains(github.event.pull_request.labels.*.name, 'CI: Run cibuildwheel') ) name: Build sdist and wheel on ${{ matrix.os }} runs-on: ${{ matrix.os }} diff --git a/.github/workflows/cibuildwheel.yml b/.github/workflows/cibuildwheel.yml index e9aac76c4599..c713a347f454 100644 --- a/.github/workflows/cibuildwheel.yml +++ b/.github/workflows/cibuildwheel.yml @@ -28,9 +28,9 @@ jobs: github.event_name == 'pull_request' && ( ( github.event.action == 'labeled' && - github.event.label.name == 'Run cibuildwheel' + github.event.label.name == 'CI: Run cibuildwheel' ) || - contains(github.event.pull_request.labels.*.name, 'Run cibuildwheel') + contains(github.event.pull_request.labels.*.name, 'CI: Run cibuildwheel') ) name: Build wheels on ${{ matrix.os }} runs-on: ${{ matrix.os }} @@ -61,6 +61,14 @@ jobs: with: fetch-depth: 0 + # Something changed somewhere that prevents the downloaded-at-build-time + # licenses from being included in built wheels, so pre-download them so + # that they exist before the build and are included. + - name: Pre-download bundled licenses + run: > + curl -Lo LICENSE/LICENSE_QHULL + https://github.com/qhull/qhull/raw/2020.2/COPYING.txt + - name: Build wheels for CPython 3.11 uses: pypa/cibuildwheel@v2.12.0 env: diff --git a/doc/_static/FigureInline.png b/doc/_static/FigureInline.png new file mode 100644 index 000000000000..6b7bd42c28f1 Binary files /dev/null and b/doc/_static/FigureInline.png differ diff --git a/doc/_static/FigureNotebook.png b/doc/_static/FigureNotebook.png new file mode 100644 index 000000000000..2d6d11cac3cc Binary files /dev/null and b/doc/_static/FigureNotebook.png differ diff --git a/doc/_static/FigureQtAgg.png b/doc/_static/FigureQtAgg.png new file mode 100644 index 000000000000..8d19e1a309ef Binary files /dev/null and b/doc/_static/FigureQtAgg.png differ diff --git a/doc/_static/zenodo_cache/7637593.svg b/doc/_static/zenodo_cache/7637593.svg new file mode 100644 index 000000000000..4e91dea5e805 --- /dev/null +++ b/doc/_static/zenodo_cache/7637593.svg @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + + + DOI + + + DOI + + + 10.5281/zenodo.7637593 + + + 10.5281/zenodo.7637593 + + + \ No newline at end of file diff --git a/doc/conf.py b/doc/conf.py index b77dfa3ba85f..acb36254db82 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -397,7 +397,11 @@ def js_tag_with_cache_busting(js): "collapse_navigation": not is_release_build, "show_prev_next": False, "switcher": { - "json_url": "https://matplotlib.org/devdocs/_static/switcher.json", + # Add a unique query to the switcher.json url. This will be ignored by + # the server, but will be used as part of the key for caching by browsers + # so when we do a new minor release the switcher will update "promptly" on + # the stable and devdocs. + "json_url": f"https://matplotlib.org/devdocs/_static/switcher.json?{SHA}", "version_match": ( # The start version to show. This must be in switcher.json. # We either go to 'stable' or to 'devdocs' diff --git a/doc/users/explain/figures.rst b/doc/users/explain/figures.rst index f5fb3142d297..617281a60f61 100644 --- a/doc/users/explain/figures.rst +++ b/doc/users/explain/figures.rst @@ -34,23 +34,57 @@ using Matplotlib, and what :ref:`Backend ` you are using. Notebooks and IDEs ------------------ +.. figure:: /_static/FigureInline.png + :alt: Image of figure generated in Jupyter Notebook with inline backend. + :width: 400 + + Screenshot of a `Jupyter Notebook `_, with a figure + generated via the default `inline + `_ backend. + + If you are using a Notebook (e.g. `Jupyter `_) or an IDE that renders Notebooks (PyCharm, VSCode, etc), then they have a backend that will render the Matplotlib Figure when a code cell is executed. One thing to be aware of is that the default Jupyter backend (``%matplotlib inline``) will by default trim or expand the figure size to have a tight box around Artists -added to the Figure (see :ref:`saving_figures`, below). +added to the Figure (see :ref:`saving_figures`, below). If you use a backend +other than the default "inline" backend, you will likely need to use an ipython +"magic" like ``%matplotlib notebook`` for the Matplotlib :ref:`notebook +` or ``%matplotlib widget`` for the `ipympl +`_ backend. + +.. figure:: /_static/FigureNotebook.png + :alt: Image of figure generated in Jupyter Notebook with notebook + backend, including a toolbar. + :width: 400 + + Screenshot of a Jupyter Notebook with an interactive figure generated via + the ``%matplotlib notebook`` magic. Users should also try the similar + `widget `_ backend if using `JupyterLab + `_. + + +.. seealso:: + :ref:`interactive_figures`. Standalone scripts and interactive use -------------------------------------- If the user is on a client with a windowing system, there are a number of :ref:`Backends ` that can be used to render the Figure to -the screen, usually using a Python Qt, Tk, or Wx toolkit, though there is a native -MacOS backend as well. These are typically chosen either in the user's -:ref:`matplotlibrc `, or by calling +the screen, usually using a Python Qt, Tk, or Wx toolkit, or the native MacOS +backend. These are typically chosen either in the user's :ref:`matplotlibrc +`, or by calling, for example, ``matplotlib.use('QtAgg')`` at the beginning of a session or script. +.. figure:: /_static/FigureQtAgg.png + :alt: Image of figure generated from a script via the QtAgg backend. + :width: 370 + + Screenshot of a Figure generated via a python script and shown using the + QtAgg backend. + When run from a script, or interactively (e.g. from an `iPython shell `_) the Figure will not be shown until we call ``plt.show()``. The Figure will appear in @@ -64,6 +98,9 @@ Note that if you are on a client that does not have access to a windowing system, the Figure will fallback to being drawn using the "Agg" backend, and cannot be viewed, though it can be :ref:`saved `. +.. seealso:: + :ref:`interactive_figures`. + .. _creating_figures: Creating Figures diff --git a/doc/users/explain/interactive.rst b/doc/users/explain/interactive.rst index 43b6327815f9..942b682fb04c 100644 --- a/doc/users/explain/interactive.rst +++ b/doc/users/explain/interactive.rst @@ -3,6 +3,7 @@ .. currentmodule:: matplotlib .. _mpl-shell: +.. _interactive_figures: =================== Interactive figures @@ -12,6 +13,10 @@ When working with data, interactivity can be invaluable. 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. +.. seealso:: + :ref:`figure_explanation`. + + Matplotlib ships with :ref:`backends ` binding to several GUI toolkits (Qt, Tk, Wx, GTK, macOS, JavaScript) and third party packages provide bindings to `kivy @@ -42,7 +47,9 @@ collected. `.Figure`\s can be closed and deregistered from `.pyplot` individuall `.pyplot.close`; all open `.Figure`\s can be closed via ``plt.close('all')``. -For more discussion of Matplotlib's event system and integrated event loops, please read: +.. seealso:: + + For more discussion of Matplotlib's event system and integrated event loops: - :ref:`interactive_figures_and_eventloops` - :ref:`event-handling-tutorial` @@ -246,6 +253,7 @@ and your figures may not be responsive. Please consult the documentation of your GUI toolkit for details. +.. _jupyter_notebooks_jupyterlab: Jupyter Notebooks / JupyterLab ------------------------------ @@ -261,7 +269,7 @@ Jupyter Notebooks / JupyterLab cells. To get interactive figures in the 'classic' notebook or Jupyter lab, -use the `ipympl `__ backend +use the `ipympl `__ backend (must be installed separately) which uses the **ipywidget** framework. If ``ipympl`` is installed use the magic: diff --git a/doc/users/github_stats.rst b/doc/users/github_stats.rst index cbeb72270f2e..c7324b556272 100644 --- a/doc/users/github_stats.rst +++ b/doc/users/github_stats.rst @@ -1,690 +1,122 @@ .. _github-stats: -GitHub statistics (Feb 13, 2023) -================================ +GitHub statistics for 3.7.1 (Mar 03, 2023) +========================================== -GitHub statistics for 2022/09/16 (tag: v3.6.0) - 2023/02/13 +GitHub statistics for 2023/02/13 (tag: v3.7.0) - 2023/03/03 These lists are automatically generated, and may be incomplete or contain duplicates. -We closed 120 issues and merged 427 pull requests. -The full list can be seen `on GitHub `__ +We closed 14 issues and merged 62 pull requests. +The full list can be seen `on GitHub `__ -The following 112 authors contributed 1962 commits. +The following 16 authors contributed 129 commits. -* Abhijnan Bajpai -* Adrien F. Vincent -* Ahoy Ahoy -* Akshit Tyagi -* Ali Meshkat -* Almar Klein -* Andrés Martínez -* Ante Sikic +* Albert Y. Shih * Antony Lee -* Augustin LAVILLE -* baharev -* cargobuild -* Carsten Schnober -* Chahak Mehta -* Charisma Kausar -* David Stansby -* dependabot[bot] -* DerWeh -* Eero Vaher +* devRD * Elliott Sales de Andrade -* Eric Larson -* Eric Prestat -* erykoff -* EunHo Lee -* Felix Goudreault +* Fabian Joswig * Greg Lucas -* hannah -* Ian Hunt-Isaak -* Ian Thomas -* intellizEHL -* iofall -* j1642 -* jacoverster -* Jae-Joon Lee -* Jakub Klus -* James Braza -* Jay Stanley -* Jef Myers -* jeffreypaul15 -* Jefro +* Hasan Rashid +* hasanrashid * Jody Klymak -* John Paul Jepko -* Joseph Fox-Rabinovitz -* Joshua Barrass -* Julian Chen -* Junaid Khan -* Justin Tracey -* Kaidong Hu -* Kanza -* Karan -* Kian Eliasi -* kolibril13 -* Kostya Farber -* Krutarth Patel * Kyle Sunden -* Leo Singer -* Lucas Ricci -* luke -* Marc Van den Bossche -* Martok -* Marvvxi -* Matthew Feickert -* Mauricio Collares -* MeeseeksMachine -* melissawm -* Mikhail Ryazanov -* Muhammad Abdur Rakib -* noatamir -* NRaudseps -* Olivier Castany * Oscar Gustafsson -* parthpankajtiwary -* Paul Seyfert -* Pavel Grunt -* Pieter Eendebak -* PIotr Strzelczyk -* Pratim Ugale -* pre-commit-ci[bot] -* ramvikrams -* richardsheridan +* Ratnabali Dutta +* RishabhSpark * Ruth Comer -* Ryan May -* saranti -* Scott Shambaugh -* Shabnam Sadegh -* Shawn Zhong -* Simon Waldherr -* Skhaki18 -* slackline -* Snipeur060 -* Sourajita Dewasi -* SourajitaDewasi -* Stefanie Molin -* Steffen Rehberg -* Sven Eschlbeck -* sveneschlbeck -* takimata -* tfpf * Thomas A Caswell -* Tiger Nie * Tim Hoffmann -* Tom -* Tortar -* tsumli -* tybeller -* vdbma -* Vishal Pankaj Chandratreya -* vivekvedant -* whyvra -* yuanx749 -* zhizheng1 -* مهدي شينون (Mehdi Chinoune) GitHub issues and pull requests: -Pull Requests (427): - -* :ghpull:`25201`: Backport PR #25196 on branch v3.7.x (Add deprecation for setting data with non sequence type in ``Line2D``) -* :ghpull:`25196`: Add deprecation for setting data with non sequence type in ``Line2D`` -* :ghpull:`25197`: Backport PR #25193 on branch v3.7.x (Fix displacement of colorbar for eps with bbox_inches='tight') -* :ghpull:`25193`: Fix displacement of colorbar for eps with bbox_inches='tight' -* :ghpull:`24781`: DOC: restore SHA to footer -* :ghpull:`25188`: Backport PR #25085 on branch v3.7.x (FIX: only try to update blit caches if the canvas we expect) -* :ghpull:`25170`: Backport PR #25097 on branch v3.7.x (fix FigureCanvasTkAgg memory leak via weakrefs) -* :ghpull:`25186`: Backport PR #24893 on branch v3.7.x (STY: make allowed line length 9 longer to 88 from 79) -* :ghpull:`25185`: Backport PR #25183 on branch v3.7.x (FIX: do not use deprecated API internally) -* :ghpull:`25184`: Backport PR #25174 on branch v3.7.x (Accept LA icons for the toolbar) -* :ghpull:`25085`: FIX: only try to update blit caches if the canvas we expect -* :ghpull:`25183`: FIX: do not use deprecated API internally -* :ghpull:`25182`: Backport PR #25052 on branch v3.7.x (Support both Bbox and list for bbox to table/Table) -* :ghpull:`25174`: Accept LA icons for the toolbar -* :ghpull:`25052`: Support both Bbox and list for bbox to table/Table -* :ghpull:`25095`: Backport PR #23442 on branch v3.7.x (Remove need to detect math mode in pgf strings) -* :ghpull:`25097`: fix FigureCanvasTkAgg memory leak via weakrefs -* :ghpull:`25167`: Backport PR #25122 on branch v3.7.x (FIX: scaling factor for window with negative value) -* :ghpull:`25122`: FIX: scaling factor for window with negative value -* :ghpull:`25161`: Backport PR #25158 on branch v3.7.x (Disconnect SubplotTool destroyer callback on tool_fig close) -* :ghpull:`25160`: Backport PR #25129 on branch v3.7.x (Undeprecate Cursor event handlers) -* :ghpull:`25158`: Disconnect SubplotTool destroyer callback on tool_fig close -* :ghpull:`25129`: Undeprecate Cursor event handlers -* :ghpull:`25154`: Backport PR #25151 on branch v3.7.x (Increase timeout to GitHub API) -* :ghpull:`25151`: Increase timeout to GitHub API -* :ghpull:`25136`: Backport PR #25126 on branch v3.7.x (FIX: fully invalidate TransformWrapper parents before swapping) -* :ghpull:`25132`: Backport PR #24993 on branch v3.7.x ([DOC] GitHub spelling and links) -* :ghpull:`25126`: FIX: fully invalidate TransformWrapper parents before swapping -* :ghpull:`24993`: [DOC] GitHub spelling and links -* :ghpull:`25118`: Backport PR #25113 on branch v3.7.x (Fix outdated comment re: _update_label_position.) -* :ghpull:`25113`: Fix outdated comment re: _update_label_position. -* :ghpull:`25111`: Backport PR #25110 on branch v3.7.x (Stop recommending ``ncol`` in legend examples) -* :ghpull:`25110`: Stop recommending ``ncol`` in legend examples -* :ghpull:`25106`: Fix cursor_demo wrt. Line2D.set_x/ydata not accepting scalars anymore. -* :ghpull:`25103`: Backport PR #25098 on branch v3.7.x (Correctly pass valinit as keyword in SliderTool.) -* :ghpull:`25098`: Correctly pass valinit as keyword in SliderTool. -* :ghpull:`23442`: Remove need to detect math mode in pgf strings -* :ghpull:`25093`: Backport PR #25092 on branch v3.7.x (Fix distribution of test data) -* :ghpull:`24893`: STY: make allowed line length 9 longer to 88 from 79 -* :ghpull:`25092`: Fix distribution of test data -* :ghpull:`25089`: Backport PR #25088 on branch v3.7.x (DOC: Fix broken cross-reference when building PDF) -* :ghpull:`25088`: DOC: Fix broken cross-reference when building PDF -* :ghpull:`25083`: Backport PR #25074 on branch v3.7.x (Revert "Use system distutils instead of the setuptools copy") -* :ghpull:`25082`: Backport PR #25079 on branch v3.7.x (FIX: Only send one update signal when autoscaling norms) -* :ghpull:`25084`: DOC: Fix typos in GitHub stats -* :ghpull:`25074`: Revert "Use system distutils instead of the setuptools copy" -* :ghpull:`25079`: FIX: Only send one update signal when autoscaling norms -* :ghpull:`25072`: Merge v3.6.x into v3.7.x -* :ghpull:`25071`: Backport PR #25039 on branch v3.7.x (Updated WebAgg JS to check and send request over wss if using HTTPS) -* :ghpull:`25039`: Updated WebAgg JS to check and send request over wss if using HTTPS -* :ghpull:`25070`: Backport PR #25058 on branch v3.7.x (fix for pcolormesh doesn't allow shading = 'flat' in the option) -* :ghpull:`25058`: fix for pcolormesh doesn't allow shading = 'flat' in the option -* :ghpull:`25067`: Backport PR #25054 on branch v3.7.x (Remove note that mathtext.fontset = "custom" is unsupported.) -* :ghpull:`25066`: Backport PR #24999 on branch v3.7.x (DOC: figure explanation) -* :ghpull:`25054`: Remove note that mathtext.fontset = "custom" is unsupported. -* :ghpull:`25065`: Backport PR #24838 on branch v3.7.x (Add styling support to Check and Radio buttons ) -* :ghpull:`24999`: DOC: figure explanation -* :ghpull:`24838`: Add styling support to Check and Radio buttons -* :ghpull:`25056`: Backport PR #25055 on branch v3.7.x (Reword awkward sentence in FAQ.) -* :ghpull:`25055`: Reword awkward sentence in FAQ. -* :ghpull:`25049`: Backport PR #25047 on branch v3.7.x (Remove dead code from deprecated-and-removed block) -* :ghpull:`25047`: Remove dead code from deprecated-and-removed block -* :ghpull:`25037`: Backport PR #25018 on branch v3.7.x (Simplify "artist reference" example.) -* :ghpull:`25018`: Simplify "artist reference" example. -* :ghpull:`25034`: Backport PR #24812 on branch v3.7.x ([Doc] expanded basic pie example) -* :ghpull:`24812`: [Doc] expanded basic pie example -* :ghpull:`25029`: Backport PR #25019 on branch v3.7.x (Tweak titles pyplot examples.) -* :ghpull:`25019`: Tweak titles pyplot examples. -* :ghpull:`25026`: Backport PR #25017 on branch v3.7.x (Capitalize headings in example Gallery) -* :ghpull:`25017`: Capitalize headings in example Gallery -* :ghpull:`25010`: Backport PR #24989 on branch v3.7.x (Suppress pyparsing warning) -* :ghpull:`25008`: Backport PR #25004 on branch v3.7.x (Bump pypa/cibuildwheel from 2.11.4 to 2.12.0) -* :ghpull:`24989`: Suppress pyparsing warning -* :ghpull:`25004`: Bump pypa/cibuildwheel from 2.11.4 to 2.12.0 -* :ghpull:`25001`: Backport PR #25000 on branch v3.7.x (Update matplotlibrc urls) -* :ghpull:`25000`: Update matplotlibrc urls -* :ghpull:`24977`: Backport PR #24970 on branch v3.7.x (FIX: Handle uint8 indices properly for colormap lookups) -* :ghpull:`24970`: FIX: Handle uint8 indices properly for colormap lookups -* :ghpull:`24975`: Backport PR #24971 on branch v3.7.x (FIX: adjust_bbox should not modify layout engine) -* :ghpull:`24974`: Backport PR #24973 on branch v3.7.x (MNT: Fix double % signs in matplotlibrc) -* :ghpull:`24966`: Backport PR #24965 on branch v3.7.x (Remove additional deprecations from 3.5) -* :ghpull:`24971`: FIX: adjust_bbox should not modify layout engine -* :ghpull:`24973`: MNT: Fix double % signs in matplotlibrc -* :ghpull:`24965`: Remove additional deprecations from 3.5 -* :ghpull:`24963`: Backport PR #24912 on branch v3.7.x (Remove contour warning for "no-valid-levels".) -* :ghpull:`24962`: Backport PR #24957 on branch v3.7.x (DOC: Enable Opensearch) -* :ghpull:`24961`: Backport PR #24948 on branch v3.7.x (Remove remaining deprecations from 3.5) -* :ghpull:`24959`: Backport PR #24254 on branch v3.7.x (Expire deprecations in widgets and keyword only arguments for Selectors) -* :ghpull:`24912`: Remove contour warning for "no-valid-levels". -* :ghpull:`24960`: Backport PR #24825 on branch v3.7.x (Allow non-default scales on polar axes) -* :ghpull:`24957`: DOC: Enable Opensearch -* :ghpull:`24948`: Remove remaining deprecations from 3.5 -* :ghpull:`24825`: Allow non-default scales on polar axes -* :ghpull:`24254`: Expire deprecations in widgets and keyword only arguments for Selectors -* :ghpull:`24956`: Backport PR #24955 on branch v3.7.x (Cleanup bullseye plot example.) -* :ghpull:`24955`: Cleanup bullseye plot example. -* :ghpull:`24949`: Backport PR #24918 on branch v3.7.x (DOC: animation faster) -* :ghpull:`24947`: Auto backport of pr 24897 on v3.7.x -* :ghpull:`24945`: Backport PR #24940 on branch v3.7.x ([MNT] specify which gallery sections come last) -* :ghpull:`24918`: DOC: animation faster -* :ghpull:`24917`: Backport PR #24897: DOC: Add ref for every under examples/animation -* :ghpull:`24940`: [MNT] specify which gallery sections come last -* :ghpull:`24941`: Backport PR #24655 on branch v3.7.x (Update font_manager to only use registry on Win) -* :ghpull:`24655`: Update font_manager to only use registry on Win -* :ghpull:`24937`: Backport PR #24470 on branch v3.7.x ([ENH] hatch keyword for pie + some pie documentation) -* :ghpull:`24938`: Backport PR #23390 on branch v3.7.x (FIX: colorbar contour with log norm should default to log locator and formatter...) -* :ghpull:`24935`: Backport PR #24934 on branch v3.7.x (Swap ipython directives for code-block directives) -* :ghpull:`24470`: [ENH] hatch keyword for pie + some pie documentation -* :ghpull:`24933`: Backport PR #24924 on branch v3.7.x (Fix toggling layout engines) -* :ghpull:`24934`: Swap ipython directives for code-block directives -* :ghpull:`24931`: Backport PR #24783 on branch v3.7.x (inset locator fix with tests added) -* :ghpull:`24924`: Fix toggling layout engines -* :ghpull:`24928`: Backport PR #24927 on branch v3.7.x (DOC: Remove space after directive name, before double-colon) -* :ghpull:`24926`: Backport PR #24925 on branch v3.7.x (DOC: Improve documentation for set_loglevel) -* :ghpull:`24925`: DOC: Improve documentation for set_loglevel -* :ghpull:`24922`: Backport PR #24921 on branch v3.7.x (Pin sphinx != 6.1.2) -* :ghpull:`24921`: Pin sphinx != 6.1.2 -* :ghpull:`24911`: Backport PR #24904 on branch v3.7.x (Deprecate AxisArtistHelpers with inconsistent loc/nth_coord.) -* :ghpull:`24897`: DOC: Add ref for every under examples/animation -* :ghpull:`24904`: Deprecate AxisArtistHelpers with inconsistent loc/nth_coord. -* :ghpull:`22314`: Add a helper to generate xy coordinates for AxisArtistHelper. -* :ghpull:`24841`: changed method in animation tutorial table of methods -* :ghpull:`24902`: Remove provisional note from pyplot.subplot_mosaic -* :ghpull:`24891`: DOC: mark mosaic as no longer provisional -* :ghpull:`24889`: Harmonize exceptions for unknown keyword arguments. -* :ghpull:`24085`: Set facecolor of FilledArrow axisline style and fix tight layout -* :ghpull:`19743`: ENH: allow fig.legend outside axes... -* :ghpull:`24887`: [MNT] Bump NumPy to 1.20 -* :ghpull:`24896`: changed contribute docs link to writing docs -* :ghpull:`24894`: DOC: explain clipbox a bit better -* :ghpull:`24864`: Deprecate BrokenBarHCollection. -* :ghpull:`24869`: Skip displaying pan/zoom navigate mode in toolbar. -* :ghpull:`24892`: FIX: error in formatting in error string in redirect extension -* :ghpull:`24895`: add new & improved doc notices to what's new -* :ghpull:`24888`: update install instructions for conda -* :ghpull:`24886`: CI: rotate the circleci deploy key -* :ghpull:`24879`: Document "." as a filled marker. -* :ghpull:`24870`: Better default bool contour levels. -* :ghpull:`24786`: Increase a few test tolerances on some arches -* :ghpull:`24863`: Add parameter doc to PolarTransform -* :ghpull:`24845`: Fix toggling of MultiCursor.{horizOn,vertOn} -* :ghpull:`24862`: Fix argument checking in ``Axes3D.quiver`` -* :ghpull:`24868`: [pre-commit.ci] pre-commit autoupdate -* :ghpull:`24840`: Simplify/robustify segment-point distance calculation. -* :ghpull:`24850`: Improve PolarAffine docstring -* :ghpull:`24851`: Variable rename t > theta -* :ghpull:`24763`: Allow polar scales where zero is not in valid interval -* :ghpull:`24846`: Promote pending cm deprecations to full deprecations -* :ghpull:`24848`: ``Collection.set_linestyle``: remove redundant string handling -* :ghpull:`24839`: Move geo/polar projections to their own pages -* :ghpull:`24727`: Handle argument "facecolors=None" correctly in plot_surface() -* :ghpull:`24847`: Avoid extra copy initializing empty Affine2D -* :ghpull:`24837`: DOC: Replace .format by f-strings in examples -* :ghpull:`24604`: Enh/extend mosaic kwargs -* :ghpull:`24131`: Deprecate attributes and expire deprecation in animation -* :ghpull:`23457`: Add blitting support to button widgets -* :ghpull:`24832`: [MNT] Improve variable naming in bar -* :ghpull:`24829`: Simplify shape-checking in QuadMesh.set_array. -* :ghpull:`24835`: Delay nightly wheel builds by 2 hours -* :ghpull:`24831`: [Doc] Fix ndarray-links for arguments -* :ghpull:`24824`: Fix incorrect method in doc -* :ghpull:`24826`: space in version added for reverse in legend -* :ghpull:`24819`: Bump pypa/cibuildwheel from 2.11.3 to 2.11.4 -* :ghpull:`24811`: removed casting handles to list in legend -* :ghpull:`24759`: Reverse legend -* :ghpull:`24465`: Reparametrize offsetbox calculations in terms of bboxes. -* :ghpull:`22316`: Arbitrary figure customization hooks. -* :ghpull:`22329`: Enforce that Line data modifications are sequences -* :ghpull:`24730`: Data access API for rcParams -* :ghpull:`24699`: Implement nested four-level TeX cache -* :ghpull:`24752`: DOC: Make event handling table scrollable -* :ghpull:`24637`: Fixes #20044 pass AnnotationBbox to renderer -* :ghpull:`24810`: Don't modify dictionary input to widgets -* :ghpull:`24769`: Improve matplotlib.axes documentation -* :ghpull:`24806`: Deprecate 'x' argument for widgets.TextBox.begin_typing -* :ghpull:`24293`: Handle rasterization start & stop only from Artist -* :ghpull:`24768`: Fix/zorder rasterization -* :ghpull:`24474`: Use scatter for check boxes and set facecolors correctly in check boxes and radio buttons -* :ghpull:`24262`: Fix issue with space allocated for single tick that should not be there -* :ghpull:`24780`: Update environment.yml -* :ghpull:`23576`: Soft deprecate the textpath module (import from text instead) -* :ghpull:`24750`: Fix deprecations of \*Cursor widget event handlers -* :ghpull:`24757`: Allow using masked in ``set_offsets`` -* :ghpull:`21661`: Fix plot directive with func calls -* :ghpull:`24803`: Correct type in docstring of zorder for streamplot and LineCollection -* :ghpull:`24801`: Correct docstring of RangeSlider.on_changed -* :ghpull:`24802`: Correct docstring of CheckButtons.get_status -* :ghpull:`24758`: MNT: Simplify code related to masked arrays -* :ghpull:`24756`: DOC: Simplify some table markup -* :ghpull:`24795`: DOC: Fix duplicate redirect -* :ghpull:`24782`: DOC: update typos and grammar errors -* :ghpull:`24794`: Update README.md -* :ghpull:`24071`: Deprecate undefined label_mode to Grid -* :ghpull:`24724`: Run delvewheel on Windows for wheels -* :ghpull:`24538`: [Doc] Document legend_handles and legend_handlers -* :ghpull:`24751`: DOC: Update Artist inheritance diagram -* :ghpull:`24761`: Don't set the never-used Line2D._contains in set_picker. -* :ghpull:`24760`: Remove unused dicts from backend_cairo. -* :ghpull:`24736`: DOC: simplify CheckButton example -* :ghpull:`22700`: MAINT: Move docstring of ``LogLocator`` to class -* :ghpull:`19763`: Remove visibility changes in draw for \*Cursor widgets -* :ghpull:`23473`: Separately track modifier keys for mouse events. -* :ghpull:`24748`: DOC: remove research notice -* :ghpull:`24734`: Support masked dates -* :ghpull:`24737`: MNT: make fig.colorbar(..., ax=INPUT) even more forgiving -* :ghpull:`24120`: don't try to start a new event loop in WebAgg when in an ipykernel -* :ghpull:`24362`: Allow bool-like values for sharex/sharey -* :ghpull:`24740`: Minor redundancy cleanup of code which sets 3D aspect 3D -* :ghpull:`22273`: Improve inheritance diagrams -* :ghpull:`24668`: Add test for remaining axis options -* :ghpull:`9598`: ENH: rely on non-rectangular patch paths rather than bboxes for legend auto-placing (fix #9580) -* :ghpull:`22920`: Mnt deprecate mlab -* :ghpull:`24408`: Fix: restore make_axes to accept a tuple of axes -* :ghpull:`24731`: DOC: Post warnings as reviews on PRs -* :ghpull:`24652`: Offsetbox default arguments -* :ghpull:`24720`: FIX: be more forgiving in default draw wrapper -* :ghpull:`24719`: Remove quotes from EngFormatter.format_eng example -* :ghpull:`24718`: Remove refresh function from polar ThetaLocator -* :ghpull:`24710`: Drop support for Qt<5.10. -* :ghpull:`24509`: Factor out & improve accuracy of derivatives calculations in axisartist. -* :ghpull:`19591`: reverse order in which stackplot elements are added to axes -* :ghpull:`24367`: STY: Update macosx zoom rect styling -* :ghpull:`24706`: Bump pypa/cibuildwheel from 2.11.2 to 2.11.3 -* :ghpull:`24705`: Cleanup a few examples. -* :ghpull:`21096`: FIX: improve symlog ticker -* :ghpull:`24498`: DOC: Update multiple category bar chart examples -* :ghpull:`24688`: Deprecate quiver_doc and barbs_doc class members -* :ghpull:`24526`: [Doc] Fix spelling and grammar in tutorials -* :ghpull:`24675`: TST: set style in mpl_toolkits to ease later transition -* :ghpull:`24484`: Artist's draw method prevents rasterization by default -* :ghpull:`24667`: Test scroll zoom bbox update -* :ghpull:`24662`: Doc/git force -* :ghpull:`24664`: Deprecate offsetbox.bbox_artist -* :ghpull:`24670`: Tiny capitalization fix. -* :ghpull:`24596`: ENH: Add ellipse class for annotation box styles -* :ghpull:`24249`: Add legend tests for 3D plots -* :ghpull:`24627`: MNT: when clearing an Axes via clear/cla fully detach children -* :ghpull:`24653`: Directly call _long_axis()._set_axes_scale in Colorbar. -* :ghpull:`24640`: Small TransformWrapper cleanups. -* :ghpull:`24528`: BUG: Warn when an existing layout manager changes to tight layout -* :ghpull:`24635`: Remove unneeded _update_transScale calls in _init_axis. -* :ghpull:`24641`: Fix that font files never pass the test on Win -* :ghpull:`24522`: Use pybind11 for tri module -* :ghpull:`24603`: Shorten the definition of sawtooth boxstyle. -* :ghpull:`24630`: Improve error message for gridspec when the index is not an integer. -* :ghpull:`24634`: Init axes._children early enough to avoid need for some getattr calls. -* :ghpull:`24629`: Doc/gitwash redirects -* :ghpull:`24624`: Expire FancyBboxPatch deprecations. -* :ghpull:`24619`: ENH: Allow RGB(A) arrays for pcolormesh -* :ghpull:`23588`: Refactoring gitwash -* :ghpull:`21549`: Unifying the Figure getter/setter interface to match its constructor -* :ghpull:`24582`: Shorten demo_axes_grid example. -* :ghpull:`24577`: Fold _set_ticklabels into set_ticklabels. -* :ghpull:`24581`: Simplify implementation of _is_sorted. -* :ghpull:`24575`: Use std::isnan and fix compiler warning -* :ghpull:`24570`: FIX: VPacker and HPacker bottom/top alignment -* :ghpull:`23812`: Ci add codeql -* :ghpull:`24556`: Fix incorrect window_extent of AxesImage -* :ghpull:`24566`: Improve argument checking for set_xticks(). -* :ghpull:`24544`: DOC: Add links to supported file formats in animations tutorial -* :ghpull:`24511`: Add test for mutating input arrays #8990 -* :ghpull:`24558`: In mplot3d, fix a doc typo and autogen zaxis_inverted. -* :ghpull:`24555`: ENH: Add warning for SymLogScale when values in linear scale range -* :ghpull:`23417`: Consistently set label on axis with units -* :ghpull:`24542`: DOC: Clarify supported animation formats in animation tutorial -* :ghpull:`23685`: Add mathtext support for ``\middle`` and correct rendering of ``\|`` -* :ghpull:`24539`: Fix misnamed api changes entry. -* :ghpull:`23692`: Add ``Axes.get_tick_params()`` method. -* :ghpull:`24132`: CenteredNorm changes -* :ghpull:`24529`: Transform ParasiteAxesBase._update_viewlim into standard callback. -* :ghpull:`24304`: Simplify some patches path definitions. -* :ghpull:`24431`: FIX: Support passing one alpha per event sequence to eventplot() -* :ghpull:`24527`: Fix testing of whether backends use the new pyplot_show API. -* :ghpull:`24537`: Fix triage tool due to test reorganization -* :ghpull:`21831`: FIX: pre-composite animation frames to white background -* :ghpull:`24205`: Plot directive: delegate file handling to Sphinx -* :ghpull:`24274`: Animation Tutorial -* :ghpull:`24519`: MNT: remove unused arguments to private methods and minor doc fixes -* :ghpull:`24525`: [Doc] Fix spelling and grammar in examples -* :ghpull:`24523`: [Doc] fix more spelling and grammar -* :ghpull:`24218`: Document what pyplot expects from a backend. -* :ghpull:`24513`: Modernize a bit floating_axes tests. -* :ghpull:`24491`: Make Path3DCollection store indexed offset, and only apply z-ordered offset during draw -* :ghpull:`24500`: DOC: Removed matplotlib from mission statement title -* :ghpull:`24490`: DOC: Remove text rotation example -* :ghpull:`24487`: Update tests to run with 3.11 (not rc) -* :ghpull:`24439`: Remove custom polar behaviour in LogLocator -* :ghpull:`24461`: Shorten and explain more calculations in axes_divider. -* :ghpull:`24472`: [DOC] removed flake8 from PR template -* :ghpull:`24467`: [DOC] swapped params in fig_compare_error msg -* :ghpull:`24455`: Draw RadioButtons using scatter to ensure circular buttons. -* :ghpull:`24462`: Don't pass unused xdescent to _get_packed_offsets. -* :ghpull:`24446`: Remove axis() manual argument parsing. -* :ghpull:`24334`: ENH: Check labels arg when kwargs passed in Axis.set_ticks() -* :ghpull:`24430`: MNT: Issue a warning instead of logging if RGB(A) passed to scatter(..., c) -* :ghpull:`24397`: Simplify appveyor to only use conda -* :ghpull:`24447`: Factor out error generation for function calls with wrong nargs. -* :ghpull:`24441`: DOC: Fix example for what's new imshow so it isn't cut off or crowded. -* :ghpull:`24443`: Add valid values to ``get_*axis_transform`` docstring -* :ghpull:`24440`: DOC: Fix colorbar what's new entry so it isn't cut off. -* :ghpull:`23787`: Use pybind11 for C/C++ extensions -* :ghpull:`24247`: Split toolkit tests into their toolkits -* :ghpull:`24432`: DOC: Fix What's New entry for bar_label() formatting. -* :ghpull:`23101`: Move show() to somewhere naturally inheritable / document what pyplot expects from a backend. -* :ghpull:`24215`: Add :shows-source-link: option to Sphinx plot directive -* :ghpull:`24423`: Tighten the Qt binding selection docs. -* :ghpull:`24403`: Use ``repr`` in error message Addresses #21959 -* :ghpull:`24415`: made f2tfont error message explicit that it needs path to file -* :ghpull:`24329`: Kill FontconfigPatternParser. -* :ghpull:`23267`: Add location keyword argument to Colorbar -* :ghpull:`24375`: DOC: Group pyplot plotting commands -* :ghpull:`24307`: DOC: Organize Axes3D methods into sections -* :ghpull:`22230`: FIX: add support for imshow extent to have units -* :ghpull:`24252`: Change default rotation mode for 3D labels to 'anchor' -* :ghpull:`24356`: Expire QuadMesh old signature deprecation -* :ghpull:`24355`: Expire unused positional parameters in canvas subclasses -* :ghpull:`24257`: Load style files from third-party packages. -* :ghpull:`24279`: Cleanup BboxImage example. -* :ghpull:`24342`: Use HTML5 for webagg files -* :ghpull:`24339`: DOC: Minor cleanup in "Writing documentation" -* :ghpull:`24338`: DOC: Group pyplot commands by category -* :ghpull:`24314`: Minor improvements to Annotations Tutorial -* :ghpull:`23914`: Add shading of Poly3DCollection -* :ghpull:`24322`: GOV: change security reporting to use tidelift -* :ghpull:`24305`: Unify logic of ConnectionStyle._Base.{_clip,_shrink}. -* :ghpull:`24303`: Simplify generate_fontconfig_pattern. -* :ghpull:`24319`: Bump mamba-org/provision-with-micromamba from 13 to 14 -* :ghpull:`24239`: Fix mathtext rendering of ``\|`` and sizing of ``|`` and ``\|`` -* :ghpull:`23606`: added offset section & restructured annotations tutorial -* :ghpull:`24125`: Expire miscellaneous deprecations from 3.5 -* :ghpull:`24306`: Remove unnecessary/replaceable explicit str calls. -* :ghpull:`24295`: Remove unnecessary np.{,as}array / astype calls. -* :ghpull:`24302`: MNT: Remove redundant int after round -* :ghpull:`24290`: Cleanup Barbs._find_tails. -* :ghpull:`24298`: List all the places to update when adding a dependency. -* :ghpull:`24289`: Cleanup image_zcoord example. -* :ghpull:`23865`: Add test and example for VBoxDivider -* :ghpull:`24287`: Simplifying glyph stream logic in ps backend -* :ghpull:`24291`: Rely on builtin round() instead of manual rounding. -* :ghpull:`24062`: Replaced std::random_shuffle with std::shuffle in tri -* :ghpull:`24278`: Use oldest-supported-numpy for build -* :ghpull:`24161`: Versioning directives policy -* :ghpull:`24013`: Deprecate matplotlib.tri.* submodules -* :ghpull:`24031`: Add rcParams for 3D pane color -* :ghpull:`24220`: Simplify and tighten parse_fontconfig_pattern. -* :ghpull:`24251`: Expire deprecation for ``auto_add_to_figure=True`` in ``Axes3D`` -* :ghpull:`24160`: sample versioning directives, empty + description -* :ghpull:`24253`: Expire deprecation of grid argument name -* :ghpull:`14471`: FIX: don't close figures if switch_backend is a no-op -* :ghpull:`24240`: Deprecate unit_cube-related methods in Axes3D -* :ghpull:`24244`: Clarify that z must be finite for tricountour(f) -* :ghpull:`23536`: Improve mpl_toolkit documentation -* :ghpull:`24243`: Improve documentation for ticker -* :ghpull:`24189`: Do not pass gridspec_kw to inner layouts in subplot_mosaic -* :ghpull:`24242`: Add information about environment variables in matplotlib.__doc__ -* :ghpull:`24241`: Small animation docs/style fixes. -* :ghpull:`24236`: DOC: Mark SubplotBase removals in code style -* :ghpull:`24141`: Set figure options dynamically -* :ghpull:`23796`: Remove useless semicolons in "Introductory / Basic Usage" tutorial -* :ghpull:`23573`: Merge SubplotBase into AxesBase. -* :ghpull:`23931`: Raise ValueError on negative number inputs for set_aspect -* :ghpull:`24065`: Fixed the positioning of cursor in Textbox: no approximation -* :ghpull:`24122`: Add textcolor to legend based on labelcolor string -* :ghpull:`24182`: MNT: Remove redundant method, fix signature and add doc-string to ``draw_tex`` -* :ghpull:`24224`: Deprecate Julian date-related functions and constant -* :ghpull:`24196`: MNT: Update pre-commit hooks -* :ghpull:`24221`: Deprecate BufferRegion.to_string{,_argb}. -* :ghpull:`23683`: Simplify/add pyparsing error messages on mathtext/fontconfig errors. -* :ghpull:`24210`: Small cleanups to axislines docs. -* :ghpull:`24213`: Cleanup make_compound_path_from_poly doc, example. -* :ghpull:`24208`: Deprecate backend_webagg.ServerThread. -* :ghpull:`24207`: Recommend multiple_yaxis_with_spines over parasite axes. -* :ghpull:`24156`: Automatically update rebase label -* :ghpull:`24198`: Deprecate unused backend_ps.{PsBackendHelper,ps_backend_helper}. -* :ghpull:`24129`: Expire cursor-related deprecations -* :ghpull:`24179`: MNT: Refactor ``Renderer.get_text_width_height_descent`` -* :ghpull:`24191`: BLD: be more cautious about checking editable mode -* :ghpull:`24000`: Generalize validation that pyplot commands are documented -* :ghpull:`24144`: Deprecate some label-related attributes on ContourLabeler. -* :ghpull:`24162`: windows doc build parity -* :ghpull:`24102`: Simplest pyproject.toml containing build-system only -* :ghpull:`24091`: MNT: Clean up code in SecondaryAxis -* :ghpull:`24140`: Replace ClabelText by set_transform_rotates_text. -* :ghpull:`24143`: Add QuadContourSet.remove. -* :ghpull:`24138`: [DOC] Fix some documentation typos -* :ghpull:`24128`: Expire deprecations in dates and ticker -* :ghpull:`23907`: Inherit OffsetBox.get_window_extent. -* :ghpull:`23449`: Add pan and zoom toolbar handling to 3D Axes (Replaces PR#22614) -* :ghpull:`24126`: Bump version when invalid hatches error -* :ghpull:`23874`: Expire parameter renaming and deletion and attribute privatization from 3.5 -* :ghpull:`23592`: Polar errcaps -* :ghpull:`24083`: Enable interactive figure resizing for webagg and nbagg backends -* :ghpull:`24110`: test readme rendering -* :ghpull:`24067`: README.rst to README.md -* :ghpull:`23702`: Get Mathtext ``\times`` symbol from ``cmsy10`` when using ``cmr10``. -* :ghpull:`24066`: Simplify svg font expansion logic. -* :ghpull:`23730`: [DOC]: Add grid to style sheets -* :ghpull:`24020`: [DOC]: adding a grid to the style sheet reference. -* :ghpull:`23579`: Remove direct manipulation of HostAxes.parasites by end users. -* :ghpull:`23553`: Add tests for ImageGrid -* :ghpull:`23918`: Merge v3.6.x branch to main -* :ghpull:`23902`: Add test and improve examples for mpl_toolkits -* :ghpull:`23950`: DOC: Don't import doctest because we're not using it -* :ghpull:`21006`: Rotate errorbar caps in polar plots -* :ghpull:`23870`: Implement Sphinx-Gallery's ``make html-noplot`` -* :ghpull:`23905`: made explicit that install link is install docs in readme -* :ghpull:`23824`: Deprecate draw_gouraud_triangle -* :ghpull:`23913`: Add draggable as param to Legend init -* :ghpull:`23896`: Inline AnchoredOffsetBox._update_offset_func. -* :ghpull:`23889`: Update image tutorial. -* :ghpull:`23861`: Move axes_grid tests to axes_grid1 -* :ghpull:`23254`: Add PathCollection test for ps backend -* :ghpull:`23542`: Add even more mplot3d tests -* :ghpull:`23698`: Fix bug in ``Axes.bar_label(label_type='center')`` for non-linear scales. -* :ghpull:`23767`: DEV: add flake8-force plugin -* :ghpull:`23835`: Fix version switcher links -* :ghpull:`23832`: Improve skip message for image comparison tests -* :ghpull:`23690`: Add new-style string formatting option and callable option to ``fmt`` in ``Axes.bar_label()``. -* :ghpull:`23804`: Fix TexManager's support for ``openin_any = p`` -* :ghpull:`23737`: Update grammar -* :ghpull:`23552`: Provide ``adjustable='box'`` to 3D axes aspect ratio setting -* :ghpull:`23769`: Bump mamba-org/provision-with-micromamba from 12 to 13 -* :ghpull:`23590`: Changing bar examples to tea and coffee -* :ghpull:`21253`: Fix: axis, ticks are set to defaults fontsize after ax.clear() -* :ghpull:`21968`: Changed fstring to make error clearer -* :ghpull:`22614`: ENH: Add pan and zoom toolbar handling to 3D Axes -* :ghpull:`21562`: Add a test for Hexbin Linear - -Issues (120): - -* :ghissue:`25176`: [Bug]: Colorbar is displaced when saving as .eps with bbox_inches='tight' -* :ghissue:`25075`: [Bug]: Widget blitting broken when saving as PDF -* :ghissue:`25181`: unavoidable warnings in nbagg on ``plt.close`` -* :ghissue:`25134`: [Doc]: pyplot.boxplot whisker length wrong docs -* :ghissue:`24395`: Any resizing of the plot after plt.show results in an error when closing the window -* :ghissue:`25107`: [Doc]: annotated_cursor example seems broken -* :ghissue:`25124`: [Bug]: ax.plot(x,y) disappears after changing y_scale -* :ghissue:`8278`: FuncAnimation with generator defaults to arbitrary save_count=100 -* :ghissue:`22765`: Document distutil vs setuptools issues or fix usage -* :ghissue:`25077`: [Bug]: Setting norm with existing colorbar fails with 3.6.3 -* :ghissue:`23999`: [Bug]: Annotation misplaced when rasterizing and saving as PDF -* :ghissue:`25040`: [Bug]: Request to insecure websocket endpoint is blocked by browser -* :ghissue:`24678`: [Bug]: pcolormesh doesn't allow shading = 'flat' in the option -* :ghissue:`15388`: matplotlib.collections.QuadMesh.set_array() input arg format is weird and undocumented -* :ghissue:`23779`: [ENH]: control the size of the tex cache -* :ghissue:`24583`: [ENH]: provide public API for styling radio buttons -* :ghissue:`21895`: [Bug]: slow rendering of multiple axes (time scales as 2nd power of label count) -* :ghissue:`4781`: Add API to register styles -* :ghissue:`24972`: [MNT]: UserWarning from pyparsing upon immediate import -* :ghissue:`24865`: [Bug]: NumPy 1.24 deprecation warnings -* :ghissue:`24954`: [Bug]: compressed layout setting can be forgotten on second save -* :ghissue:`23778`: [ENH]: Allow override of contour level autoscaling -* :ghissue:`20203`: contour edge case with all data below levels and a surrounding field of zeros -* :ghissue:`12803`: pcolormesh in log polar coordinates -* :ghissue:`24383`: log scale and polar broken -* :ghissue:`22847`: [Bug]: Cannot toggle set_tight_layout -* :ghissue:`23646`: [Bug]: matplotlib.set_loglevel() adds a console handler -* :ghissue:`24673`: [Doc]: animation examples show controls; source does not reproduce them -* :ghissue:`7617`: set_ylabel does not work as expected with SubplotZero -* :ghissue:`13023`: constrained_layout support for figure.legend -* :ghissue:`15973`: span_where fails with timeseries on the x-axis -* :ghissue:`24867`: [Bug]: controlling text on toolbar in wx -* :ghissue:`24421`: [Doc]: change to install from conda forge -* :ghissue:`24890`: [Bug]: Clipping mask can shift in PDF and SVG file outputs when Bbox is adjusted -* :ghissue:`23849`: [Bug]: The point marker is not actually unfilled -* :ghissue:`24321`: [ENH]: Auto-detect bool arrays passed to contour()? -* :ghissue:`24842`: axes3d.quiver() fails when providing args to Line3DCollection -* :ghissue:`24093`: [Bug]: CenteredNorm gets stuck in infinite recursion when given all zeros -* :ghissue:`24571`: [ENH]: gridspec_mosaic -* :ghissue:`24815`: [TST] Upcoming dependency test failures -* :ghissue:`24712`: [ENH]: Reverse legend -* :ghissue:`22308`: [Bug] set_3d_properties type error in Matplotlib 3.5.1 -* :ghissue:`24741`: [Doc]: tables in "notes" cut off content -* :ghissue:`20044`: AnnotationBbox gid not passed to renderer -* :ghissue:`24762`: [Doc]: Development workflow doc has lots of typos and clunky sentences -* :ghissue:`24235`: [Bug]: pcolormesh(rasterized=True) conflicts with set_rasterization_zorder() -* :ghissue:`24471`: [Bug]: CheckBoxes should be square, not rectangular -* :ghissue:`18804`: bugged pads on savefig -* :ghissue:`20656`: Sphinx extension plot_directive not able to detect function -* :ghissue:`24704`: [Bug]: ImportError: DLL load failed on Windows -* :ghissue:`20639`: document Legend.legendHandles -* :ghissue:`19633`: Multicursor disappears when not moving on nbagg with useblit=False + burns CPU -* :ghissue:`24717`: Update Research Notice on README.md -* :ghissue:`22754`: [Bug]: It is recommended for you to run autogen before configuring freetype -* :ghissue:`24349`: [Bug]: sharex and sharey don't accept 0 and 1 as bool values -* :ghissue:`20577`: Using ``legend(labelcolor="markerfacecolor")`` with a scatter plot throws an error -* :ghissue:`24424`: [Doc]: Inheritance diagrams -* :ghissue:`9580`: Broken legend auto-position with step*-type histograms -* :ghissue:`22176`: [MNT]: Write a bot to post doc build issues -* :ghissue:`24623`: [Bug]: ``offsetbox`` classes have optional arguments that are really not optional -* :ghissue:`24693`: [MNT]: Update minver policy re: GUI toolkits -* :ghissue:`23566`: [ENH]: Z-axis/3D support for Figure options -* :ghissue:`23777`: [ENH] Interactive Zoom Rectangle Color Review for MACOSX backend -* :ghissue:`24676`: [Doc]: quiver_doc etc leads to documentation of the documentation string -* :ghissue:`24568`: [ENH]: Ellipse annotation -* :ghissue:`6982`: cla(), clf() should unset the ``.axes`` and ``.figure`` attributes of deparented artists -* :ghissue:`11227`: fig.set_dpi() does not set the dpi correctly -* :ghissue:`24418`: [ENH]: rgp or rgba option for pyplot pcolormesh and/or pcolor -* :ghissue:`22236`: [Bug]: integer colours for pcolorfast / quadmesh -* :ghissue:`4277`: RGB not supported in pcolormesh -* :ghissue:`23155`: [ENH]: do_3d_projection could restore original verts order after draw() finishes -* :ghissue:`24386`: [Bug]: ``align`` in ``HPacker`` is reversed -* :ghissue:`23803`: Static code analysis -* :ghissue:`8990`: Surprising behaviour of mutating input arrays to Axes.plot vs Axes3D.plot -* :ghissue:`24550`: [ENH]: Warn when a SymLogScale receives values that are all in the linear regime -* :ghissue:`23416`: [Bug]: Inconsistent y-axis unit label with plot/scatter -* :ghissue:`23603`: [MNT]: Only a subset of attributes set via ``Axes.tick_params()`` are accessible via public methods and attributes -* :ghissue:`13858`: matplotlib.sphinxext.plot_directive generates incorrect links when using dirhtml builder -* :ghissue:`19376`: eventplot: allow a list of alpha channels as in the case with colors -* :ghissue:`24508`: [Bug]: Re-organization of mpl_toolkits tests broke tools/triage_tests.py -* :ghissue:`19040`: v3.3.0 Regression, Animation draws artists multiple times. -* :ghissue:`12324`: DOC: Write a unified backend doc -* :ghissue:`24464`: Issue with legend labelcolor='linecolor' for errorbar plots -* :ghissue:`24273`: [ENH]: Axes.set_xticks/Axis.set_ticks only validates kwargs if ticklabels are set, but they should -* :ghissue:`24454`: [Bug]: "import matplotlib.pyplot" gives ModuleNotFoundError -* :ghissue:`24394`: [TST]: Appveyor Qt tests failing -* :ghissue:`21959`: [ENH]: Use ``repr`` instead of ``str`` in the error message -* :ghissue:`22676`: [ENH]: Colorbar should support location kwarg that sets both orientation and ticklocation -* :ghissue:`23901`: [Doc]: add summary table to Axes3D similar to Axes -* :ghissue:`22105`: [Bug]: imshow extents can't have units? -* :ghissue:`21878`: [MNT]: make axis labels of 3d axis anchor-rotate -* :ghissue:`17978`: Document how to distribute style files in python packages -* :ghissue:`23965`: Simplify glyph stream logic in ps backend -* :ghissue:`19509`: Adding lightsource when plotting Poly3DCollection -* :ghissue:`17523`: Unclear if no gallery argument for doc builds works -* :ghissue:`23250`: [Bug]: Incorrect mathtext rendering of ``r"$\|$"`` with default (dejavu) math fontfamily -* :ghissue:`24010`: c++17 removed random_shuffle -* :ghissue:`20424`: function shadowing their own definition modules -* :ghissue:`20781`: Make the pane color in 3d plots configurable -* :ghissue:`14426`: Existing FigureCanvasQT objects destroyed by call to plt.figure -* :ghissue:`5908`: Unclear Documentation ticker class -* :ghissue:`24099`: [Bug]: Error using width_ratios with nested mosaic in subplot_mosaic() -* :ghissue:`6893`: List environment variables in matplotlib.__doc__ -* :ghissue:`11445`: The axes module structure -* :ghissue:`23847`: [Bug]: set_aspect with negative argument leads to infinite loop -* :ghissue:`24136`: [Doc]: document ``julian2num`` and ``num2julian``? -* :ghissue:`5332`: QuadContourSet lacks remove method -* :ghissue:`110`: pan and zoom are broken for mplot3d -* :ghissue:`441`: Polar plot error bars don't rotate with angle -* :ghissue:`24064`: Convert readme.rst to readme.md -* :ghissue:`10029`: \times in minor ticklabels not recognized due to \mathdefault -* :ghissue:`24080`: verify quoting method in svg backend for font names -* :ghissue:`23601`: [Doc]: add gridlines to style sheet reference -* :ghissue:`24075`: [ENH]: Resizing the figure with webagg backend by dragging the corner -* :ghissue:`23352`: [Doc]: bar examples should probably not have "score by ... gender" in them... -* :ghissue:`23819`: [MNT]: Make draw_gouraud_triangle optional -* :ghissue:`9181`: legend draggable as keyword -* :ghissue:`23688`: [Bug]: ``Axes.bar_label()`` on log scale does not center the label. -* :ghissue:`23689`: [ENH]: Add f-string formatting to labels in ``Axes.bar_label()`` -* :ghissue:`23718`: [Bug]: Installing from source fails during Freetype compilation with spaces in working directory filepath +Pull Requests (62): + +* :ghpull:`25377`: Backport PR #25372 on branch v3.7.x (Clean up Curve ArrowStyle docs) +* :ghpull:`25376`: Backport PR #25371 on branch v3.7.x (Tk: Fix size of spacers when changing display DPI) +* :ghpull:`25375`: Backport PR #25364 on branch v3.7.x (BLD: Pre-download Qhull license to put in wheels) +* :ghpull:`25372`: Clean up Curve ArrowStyle docs +* :ghpull:`25371`: Tk: Fix size of spacers when changing display DPI +* :ghpull:`25364`: BLD: Pre-download Qhull license to put in wheels +* :ghpull:`25370`: Backport PR#25369: Pin sphinx themes more strictly +* :ghpull:`25368`: Backport PR #25339 on branch v3.7.x (Disable discarded animation warning on save) +* :ghpull:`25369`: Pin sphinx themes more strictly +* :ghpull:`25339`: Disable discarded animation warning on save +* :ghpull:`25354`: Backport PR #25353 on branch v3.7.x (link to ipympl docs instead of github) +* :ghpull:`25307`: Pin mpl-sphinx-theme on the v3.7.x branch +* :ghpull:`25350`: Backport PR #25346 on branch v3.7.x (FIX: use wrapped text in Text._get_layout) +* :ghpull:`25348`: Backport PR #25325 on branch v3.7.x (Clean up legend loc parameter documentation) +* :ghpull:`25325`: Clean up legend loc parameter documentation +* :ghpull:`25346`: FIX: use wrapped text in Text._get_layout +* :ghpull:`25343`: Backport PR #25340 on branch v3.7.x (Fix RangeSlider.set_val when outside existing value) +* :ghpull:`25342`: Backport PR #25341 on branch v3.7.x (TST: Increase test_set_line_coll_dash_image tolerance slightly.) +* :ghpull:`25340`: Fix RangeSlider.set_val when outside existing value +* :ghpull:`25341`: TST: Increase test_set_line_coll_dash_image tolerance slightly. +* :ghpull:`25337`: Backport PR #25311 on branch v3.7.x (Make draggable legends picklable.) +* :ghpull:`25311`: Make draggable legends picklable. +* :ghpull:`25331`: Backport PR #25327 on branch v3.7.x (Fix doc-string issues identified by velin) +* :ghpull:`25327`: Fix doc-string issues identified by velin +* :ghpull:`25321`: Backport PR #25320 on branch v3.7.x (DOC: fix typo) +* :ghpull:`25319`: Backport PR #25305 on branch v3.7.x (DOC: add layout='none' option to Figure constructor) +* :ghpull:`25305`: DOC: add layout='none' option to Figure constructor +* :ghpull:`25315`: Backport PR #24878 on branch v3.7.x ( [Doc]: Add alt-text to images in 3.6 release notes #24844 ) +* :ghpull:`24878`: [Doc]: Add alt-text to images in 3.6 release notes #24844 +* :ghpull:`25312`: Backport PR #25308 on branch v3.7.x (DOC: add include source to a 3.7 whats new) +* :ghpull:`25309`: Backport PR #25302 on branch v3.7.x (Cleanup gradient_bar example.) +* :ghpull:`25299`: Backport PR #25238 on branch v3.7.x (Check file path for animation and raise if it does not exist) +* :ghpull:`25297`: Backport PR #25295 on branch v3.7.x (Increase timeout for interactive backend tests) +* :ghpull:`25238`: Check file path for animation and raise if it does not exist +* :ghpull:`25295`: Increase timeout for interactive backend tests +* :ghpull:`25288`: Backport PR #25279 on branch v3.7.x (Fix Lasso line cleanup) +* :ghpull:`25294`: Backport PR #25278 on branch v3.7.x (Revert #23417 (Consistently set label on axis with units)) +* :ghpull:`25293`: Backport PR #25155 on branch v3.7.x (Fix lasso unresponsive issue by adding a lock release event) +* :ghpull:`25289`: Backport PR #25286 on branch v3.7.x (DOC: add cache-busting query to switcher json url) +* :ghpull:`25278`: Revert #23417 (Consistently set label on axis with units) +* :ghpull:`25155`: Fix lasso unresponsive issue by adding a lock release event +* :ghpull:`25285`: Backport PR #25280 on branch v3.7.x (Fix setting CSS with latest GTK4) +* :ghpull:`25279`: Fix Lasso line cleanup +* :ghpull:`25284`: Backport PR #25283 on branch v3.7.x (CI: unpin reviewdog eslint) +* :ghpull:`25280`: Fix setting CSS with latest GTK4 +* :ghpull:`25283`: CI: unpin reviewdog eslint +* :ghpull:`25277`: Backport PR #25268 on branch v3.7.x (Fix import of styles with relative path) +* :ghpull:`25276`: Backport PR #25237 on branch v3.7.x (Fixed a bug where rcParams settings were being ignored for formatting axes labels) +* :ghpull:`25237`: Fixed a bug where rcParams settings were being ignored for formatting axes labels +* :ghpull:`25268`: Fix import of styles with relative path +* :ghpull:`25264`: Backport PR #25262 on branch v3.7.x (CI: Pin reviewdog eslint to use node 18.13) +* :ghpull:`25245`: Backport PR #25236: Re-enable CI buildwheel and cygwin labels +* :ghpull:`25262`: CI: Pin reviewdog eslint to use node 18.13 +* :ghpull:`25260`: Backport PR #25234 on branch v3.7.x (added layout="compressed" for pyplot #25223) +* :ghpull:`25234`: added layout="compressed" for pyplot #25223 +* :ghpull:`25246`: Backport PR #25240 on branch v3.7.x (Avoid calling vars() on arbitrary third-party manager_class.) +* :ghpull:`25240`: Avoid calling vars() on arbitrary third-party manager_class. +* :ghpull:`25236`: Re-enable CI buildwheel and cygwin labels +* :ghpull:`25217`: Backport PR #25213 on branch v3.7.x (DOC: correct default value of pcolormesh shading) +* :ghpull:`25213`: DOC: correct default value of pcolormesh shading +* :ghpull:`25215`: Backport PR #25198 - DOC: remove constrained_layout kwarg from examples +* :ghpull:`25198`: DOC: remove constrained_layout kwarg from examples + +Issues (14): + +* :ghissue:`25361`: [Doc]: matplotlib.patches.ArrowStyle +* :ghissue:`25365`: [Bug]: Inconsistent size/padx for spacers in NavigationToolbar2Tk._rescale and _Spacer +* :ghissue:`25212`: [Bug]: LICENSE_QHULL is included in wheel only the second time +* :ghissue:`25323`: [Doc]: Misleading Figure.legend() options, loc='best' is not valid. +* :ghissue:`25336`: [Bug]: constrained layout with wrapped titles +* :ghissue:`25338`: [Bug]: set_val of rangeslider sets incorrect value +* :ghissue:`25300`: [Bug]: Unable to pickle figure with draggable legend +* :ghissue:`25223`: [Doc]: ``layout="none"`` for figure constructor? +* :ghissue:`25219`: [Bug]: axes.set_xlim with string dates raises when plotting with datetimes +* :ghissue:`21666`: [Doc]: Sidebar not always very helpful +* :ghissue:`25298`: [Bug]: ``axes.labelsize`` is ignored +* :ghissue:`25233`: [MNT]: FFMpegWriter does not check if out path exists when initialized. +* :ghissue:`25242`: [Bug]: Relative paths in ``plt.style.use()`` no longer work in 3.7 +* :ghissue:`25251`: [CI]: eslint failure Previous GitHub statistics -------------------------- - .. toctree:: :maxdepth: 1 :glob: diff --git a/doc/users/prev_whats_new/github_stats_3.7.0.rst b/doc/users/prev_whats_new/github_stats_3.7.0.rst new file mode 100644 index 000000000000..754c4c1fc059 --- /dev/null +++ b/doc/users/prev_whats_new/github_stats_3.7.0.rst @@ -0,0 +1,681 @@ +.. _github-stats-3-7-0: + +GitHub statistics for 3.7.0 (Feb 13, 2023) +========================================== + +GitHub statistics for 2022/09/16 (tag: v3.6.0) - 2023/02/13 + +These lists are automatically generated, and may be incomplete or contain duplicates. + +We closed 120 issues and merged 427 pull requests. +The full list can be seen `on GitHub `__ + +The following 112 authors contributed 1962 commits. + +* Abhijnan Bajpai +* Adrien F. Vincent +* Ahoy Ahoy +* Akshit Tyagi +* Ali Meshkat +* Almar Klein +* Andrés Martínez +* Ante Sikic +* Antony Lee +* Augustin LAVILLE +* baharev +* cargobuild +* Carsten Schnober +* Chahak Mehta +* Charisma Kausar +* David Stansby +* dependabot[bot] +* DerWeh +* Eero Vaher +* Elliott Sales de Andrade +* Eric Larson +* Eric Prestat +* erykoff +* EunHo Lee +* Felix Goudreault +* Greg Lucas +* hannah +* Ian Hunt-Isaak +* Ian Thomas +* intellizEHL +* iofall +* j1642 +* jacoverster +* Jae-Joon Lee +* Jakub Klus +* James Braza +* Jay Stanley +* Jef Myers +* jeffreypaul15 +* Jefro +* Jody Klymak +* John Paul Jepko +* Joseph Fox-Rabinovitz +* Joshua Barrass +* Julian Chen +* Junaid Khan +* Justin Tracey +* Kaidong Hu +* Kanza +* Karan +* Kian Eliasi +* kolibril13 +* Kostya Farber +* Krutarth Patel +* Kyle Sunden +* Leo Singer +* Lucas Ricci +* luke +* Marc Van den Bossche +* Martok +* Marvvxi +* Matthew Feickert +* Mauricio Collares +* MeeseeksMachine +* melissawm +* Mikhail Ryazanov +* Muhammad Abdur Rakib +* noatamir +* NRaudseps +* Olivier Castany +* Oscar Gustafsson +* parthpankajtiwary +* Paul Seyfert +* Pavel Grunt +* Pieter Eendebak +* PIotr Strzelczyk +* Pratim Ugale +* pre-commit-ci[bot] +* ramvikrams +* richardsheridan +* Ruth Comer +* Ryan May +* saranti +* Scott Shambaugh +* Shabnam Sadegh +* Shawn Zhong +* Simon Waldherr +* Skhaki18 +* slackline +* Snipeur060 +* Sourajita Dewasi +* SourajitaDewasi +* Stefanie Molin +* Steffen Rehberg +* Sven Eschlbeck +* sveneschlbeck +* takimata +* tfpf +* Thomas A Caswell +* Tiger Nie +* Tim Hoffmann +* Tom +* Tortar +* tsumli +* tybeller +* vdbma +* Vishal Pankaj Chandratreya +* vivekvedant +* whyvra +* yuanx749 +* zhizheng1 +* مهدي شينون (Mehdi Chinoune) + +GitHub issues and pull requests: + +Pull Requests (427): + +* :ghpull:`25201`: Backport PR #25196 on branch v3.7.x (Add deprecation for setting data with non sequence type in ``Line2D``) +* :ghpull:`25196`: Add deprecation for setting data with non sequence type in ``Line2D`` +* :ghpull:`25197`: Backport PR #25193 on branch v3.7.x (Fix displacement of colorbar for eps with bbox_inches='tight') +* :ghpull:`25193`: Fix displacement of colorbar for eps with bbox_inches='tight' +* :ghpull:`24781`: DOC: restore SHA to footer +* :ghpull:`25188`: Backport PR #25085 on branch v3.7.x (FIX: only try to update blit caches if the canvas we expect) +* :ghpull:`25170`: Backport PR #25097 on branch v3.7.x (fix FigureCanvasTkAgg memory leak via weakrefs) +* :ghpull:`25186`: Backport PR #24893 on branch v3.7.x (STY: make allowed line length 9 longer to 88 from 79) +* :ghpull:`25185`: Backport PR #25183 on branch v3.7.x (FIX: do not use deprecated API internally) +* :ghpull:`25184`: Backport PR #25174 on branch v3.7.x (Accept LA icons for the toolbar) +* :ghpull:`25085`: FIX: only try to update blit caches if the canvas we expect +* :ghpull:`25183`: FIX: do not use deprecated API internally +* :ghpull:`25182`: Backport PR #25052 on branch v3.7.x (Support both Bbox and list for bbox to table/Table) +* :ghpull:`25174`: Accept LA icons for the toolbar +* :ghpull:`25052`: Support both Bbox and list for bbox to table/Table +* :ghpull:`25095`: Backport PR #23442 on branch v3.7.x (Remove need to detect math mode in pgf strings) +* :ghpull:`25097`: fix FigureCanvasTkAgg memory leak via weakrefs +* :ghpull:`25167`: Backport PR #25122 on branch v3.7.x (FIX: scaling factor for window with negative value) +* :ghpull:`25122`: FIX: scaling factor for window with negative value +* :ghpull:`25161`: Backport PR #25158 on branch v3.7.x (Disconnect SubplotTool destroyer callback on tool_fig close) +* :ghpull:`25160`: Backport PR #25129 on branch v3.7.x (Undeprecate Cursor event handlers) +* :ghpull:`25158`: Disconnect SubplotTool destroyer callback on tool_fig close +* :ghpull:`25129`: Undeprecate Cursor event handlers +* :ghpull:`25154`: Backport PR #25151 on branch v3.7.x (Increase timeout to GitHub API) +* :ghpull:`25151`: Increase timeout to GitHub API +* :ghpull:`25136`: Backport PR #25126 on branch v3.7.x (FIX: fully invalidate TransformWrapper parents before swapping) +* :ghpull:`25132`: Backport PR #24993 on branch v3.7.x ([DOC] GitHub spelling and links) +* :ghpull:`25126`: FIX: fully invalidate TransformWrapper parents before swapping +* :ghpull:`24993`: [DOC] GitHub spelling and links +* :ghpull:`25118`: Backport PR #25113 on branch v3.7.x (Fix outdated comment re: _update_label_position.) +* :ghpull:`25113`: Fix outdated comment re: _update_label_position. +* :ghpull:`25111`: Backport PR #25110 on branch v3.7.x (Stop recommending ``ncol`` in legend examples) +* :ghpull:`25110`: Stop recommending ``ncol`` in legend examples +* :ghpull:`25106`: Fix cursor_demo wrt. Line2D.set_x/ydata not accepting scalars anymore. +* :ghpull:`25103`: Backport PR #25098 on branch v3.7.x (Correctly pass valinit as keyword in SliderTool.) +* :ghpull:`25098`: Correctly pass valinit as keyword in SliderTool. +* :ghpull:`23442`: Remove need to detect math mode in pgf strings +* :ghpull:`25093`: Backport PR #25092 on branch v3.7.x (Fix distribution of test data) +* :ghpull:`24893`: STY: make allowed line length 9 longer to 88 from 79 +* :ghpull:`25092`: Fix distribution of test data +* :ghpull:`25089`: Backport PR #25088 on branch v3.7.x (DOC: Fix broken cross-reference when building PDF) +* :ghpull:`25088`: DOC: Fix broken cross-reference when building PDF +* :ghpull:`25083`: Backport PR #25074 on branch v3.7.x (Revert "Use system distutils instead of the setuptools copy") +* :ghpull:`25082`: Backport PR #25079 on branch v3.7.x (FIX: Only send one update signal when autoscaling norms) +* :ghpull:`25084`: DOC: Fix typos in GitHub stats +* :ghpull:`25074`: Revert "Use system distutils instead of the setuptools copy" +* :ghpull:`25079`: FIX: Only send one update signal when autoscaling norms +* :ghpull:`25072`: Merge v3.6.x into v3.7.x +* :ghpull:`25071`: Backport PR #25039 on branch v3.7.x (Updated WebAgg JS to check and send request over wss if using HTTPS) +* :ghpull:`25039`: Updated WebAgg JS to check and send request over wss if using HTTPS +* :ghpull:`25070`: Backport PR #25058 on branch v3.7.x (fix for pcolormesh doesn't allow shading = 'flat' in the option) +* :ghpull:`25058`: fix for pcolormesh doesn't allow shading = 'flat' in the option +* :ghpull:`25067`: Backport PR #25054 on branch v3.7.x (Remove note that mathtext.fontset = "custom" is unsupported.) +* :ghpull:`25066`: Backport PR #24999 on branch v3.7.x (DOC: figure explanation) +* :ghpull:`25054`: Remove note that mathtext.fontset = "custom" is unsupported. +* :ghpull:`25065`: Backport PR #24838 on branch v3.7.x (Add styling support to Check and Radio buttons ) +* :ghpull:`24999`: DOC: figure explanation +* :ghpull:`24838`: Add styling support to Check and Radio buttons +* :ghpull:`25056`: Backport PR #25055 on branch v3.7.x (Reword awkward sentence in FAQ.) +* :ghpull:`25055`: Reword awkward sentence in FAQ. +* :ghpull:`25049`: Backport PR #25047 on branch v3.7.x (Remove dead code from deprecated-and-removed block) +* :ghpull:`25047`: Remove dead code from deprecated-and-removed block +* :ghpull:`25037`: Backport PR #25018 on branch v3.7.x (Simplify "artist reference" example.) +* :ghpull:`25018`: Simplify "artist reference" example. +* :ghpull:`25034`: Backport PR #24812 on branch v3.7.x ([Doc] expanded basic pie example) +* :ghpull:`24812`: [Doc] expanded basic pie example +* :ghpull:`25029`: Backport PR #25019 on branch v3.7.x (Tweak titles pyplot examples.) +* :ghpull:`25019`: Tweak titles pyplot examples. +* :ghpull:`25026`: Backport PR #25017 on branch v3.7.x (Capitalize headings in example Gallery) +* :ghpull:`25017`: Capitalize headings in example Gallery +* :ghpull:`25010`: Backport PR #24989 on branch v3.7.x (Suppress pyparsing warning) +* :ghpull:`25008`: Backport PR #25004 on branch v3.7.x (Bump pypa/cibuildwheel from 2.11.4 to 2.12.0) +* :ghpull:`24989`: Suppress pyparsing warning +* :ghpull:`25004`: Bump pypa/cibuildwheel from 2.11.4 to 2.12.0 +* :ghpull:`25001`: Backport PR #25000 on branch v3.7.x (Update matplotlibrc urls) +* :ghpull:`25000`: Update matplotlibrc urls +* :ghpull:`24977`: Backport PR #24970 on branch v3.7.x (FIX: Handle uint8 indices properly for colormap lookups) +* :ghpull:`24970`: FIX: Handle uint8 indices properly for colormap lookups +* :ghpull:`24975`: Backport PR #24971 on branch v3.7.x (FIX: adjust_bbox should not modify layout engine) +* :ghpull:`24974`: Backport PR #24973 on branch v3.7.x (MNT: Fix double % signs in matplotlibrc) +* :ghpull:`24966`: Backport PR #24965 on branch v3.7.x (Remove additional deprecations from 3.5) +* :ghpull:`24971`: FIX: adjust_bbox should not modify layout engine +* :ghpull:`24973`: MNT: Fix double % signs in matplotlibrc +* :ghpull:`24965`: Remove additional deprecations from 3.5 +* :ghpull:`24963`: Backport PR #24912 on branch v3.7.x (Remove contour warning for "no-valid-levels".) +* :ghpull:`24962`: Backport PR #24957 on branch v3.7.x (DOC: Enable Opensearch) +* :ghpull:`24961`: Backport PR #24948 on branch v3.7.x (Remove remaining deprecations from 3.5) +* :ghpull:`24959`: Backport PR #24254 on branch v3.7.x (Expire deprecations in widgets and keyword only arguments for Selectors) +* :ghpull:`24912`: Remove contour warning for "no-valid-levels". +* :ghpull:`24960`: Backport PR #24825 on branch v3.7.x (Allow non-default scales on polar axes) +* :ghpull:`24957`: DOC: Enable Opensearch +* :ghpull:`24948`: Remove remaining deprecations from 3.5 +* :ghpull:`24825`: Allow non-default scales on polar axes +* :ghpull:`24254`: Expire deprecations in widgets and keyword only arguments for Selectors +* :ghpull:`24956`: Backport PR #24955 on branch v3.7.x (Cleanup bullseye plot example.) +* :ghpull:`24955`: Cleanup bullseye plot example. +* :ghpull:`24949`: Backport PR #24918 on branch v3.7.x (DOC: animation faster) +* :ghpull:`24947`: Auto backport of pr 24897 on v3.7.x +* :ghpull:`24945`: Backport PR #24940 on branch v3.7.x ([MNT] specify which gallery sections come last) +* :ghpull:`24918`: DOC: animation faster +* :ghpull:`24917`: Backport PR #24897: DOC: Add ref for every under examples/animation +* :ghpull:`24940`: [MNT] specify which gallery sections come last +* :ghpull:`24941`: Backport PR #24655 on branch v3.7.x (Update font_manager to only use registry on Win) +* :ghpull:`24655`: Update font_manager to only use registry on Win +* :ghpull:`24937`: Backport PR #24470 on branch v3.7.x ([ENH] hatch keyword for pie + some pie documentation) +* :ghpull:`24938`: Backport PR #23390 on branch v3.7.x (FIX: colorbar contour with log norm should default to log locator and formatter...) +* :ghpull:`24935`: Backport PR #24934 on branch v3.7.x (Swap ipython directives for code-block directives) +* :ghpull:`24470`: [ENH] hatch keyword for pie + some pie documentation +* :ghpull:`24933`: Backport PR #24924 on branch v3.7.x (Fix toggling layout engines) +* :ghpull:`24934`: Swap ipython directives for code-block directives +* :ghpull:`24931`: Backport PR #24783 on branch v3.7.x (inset locator fix with tests added) +* :ghpull:`24924`: Fix toggling layout engines +* :ghpull:`24928`: Backport PR #24927 on branch v3.7.x (DOC: Remove space after directive name, before double-colon) +* :ghpull:`24926`: Backport PR #24925 on branch v3.7.x (DOC: Improve documentation for set_loglevel) +* :ghpull:`24925`: DOC: Improve documentation for set_loglevel +* :ghpull:`24922`: Backport PR #24921 on branch v3.7.x (Pin sphinx != 6.1.2) +* :ghpull:`24921`: Pin sphinx != 6.1.2 +* :ghpull:`24911`: Backport PR #24904 on branch v3.7.x (Deprecate AxisArtistHelpers with inconsistent loc/nth_coord.) +* :ghpull:`24897`: DOC: Add ref for every under examples/animation +* :ghpull:`24904`: Deprecate AxisArtistHelpers with inconsistent loc/nth_coord. +* :ghpull:`22314`: Add a helper to generate xy coordinates for AxisArtistHelper. +* :ghpull:`24841`: changed method in animation tutorial table of methods +* :ghpull:`24902`: Remove provisional note from pyplot.subplot_mosaic +* :ghpull:`24891`: DOC: mark mosaic as no longer provisional +* :ghpull:`24889`: Harmonize exceptions for unknown keyword arguments. +* :ghpull:`24085`: Set facecolor of FilledArrow axisline style and fix tight layout +* :ghpull:`19743`: ENH: allow fig.legend outside axes... +* :ghpull:`24887`: [MNT] Bump NumPy to 1.20 +* :ghpull:`24896`: changed contribute docs link to writing docs +* :ghpull:`24894`: DOC: explain clipbox a bit better +* :ghpull:`24864`: Deprecate BrokenBarHCollection. +* :ghpull:`24869`: Skip displaying pan/zoom navigate mode in toolbar. +* :ghpull:`24892`: FIX: error in formatting in error string in redirect extension +* :ghpull:`24895`: add new & improved doc notices to what's new +* :ghpull:`24888`: update install instructions for conda +* :ghpull:`24886`: CI: rotate the circleci deploy key +* :ghpull:`24879`: Document "." as a filled marker. +* :ghpull:`24870`: Better default bool contour levels. +* :ghpull:`24786`: Increase a few test tolerances on some arches +* :ghpull:`24863`: Add parameter doc to PolarTransform +* :ghpull:`24845`: Fix toggling of MultiCursor.{horizOn,vertOn} +* :ghpull:`24862`: Fix argument checking in ``Axes3D.quiver`` +* :ghpull:`24868`: [pre-commit.ci] pre-commit autoupdate +* :ghpull:`24840`: Simplify/robustify segment-point distance calculation. +* :ghpull:`24850`: Improve PolarAffine docstring +* :ghpull:`24851`: Variable rename t > theta +* :ghpull:`24763`: Allow polar scales where zero is not in valid interval +* :ghpull:`24846`: Promote pending cm deprecations to full deprecations +* :ghpull:`24848`: ``Collection.set_linestyle``: remove redundant string handling +* :ghpull:`24839`: Move geo/polar projections to their own pages +* :ghpull:`24727`: Handle argument "facecolors=None" correctly in plot_surface() +* :ghpull:`24847`: Avoid extra copy initializing empty Affine2D +* :ghpull:`24837`: DOC: Replace .format by f-strings in examples +* :ghpull:`24604`: Enh/extend mosaic kwargs +* :ghpull:`24131`: Deprecate attributes and expire deprecation in animation +* :ghpull:`23457`: Add blitting support to button widgets +* :ghpull:`24832`: [MNT] Improve variable naming in bar +* :ghpull:`24829`: Simplify shape-checking in QuadMesh.set_array. +* :ghpull:`24835`: Delay nightly wheel builds by 2 hours +* :ghpull:`24831`: [Doc] Fix ndarray-links for arguments +* :ghpull:`24824`: Fix incorrect method in doc +* :ghpull:`24826`: space in version added for reverse in legend +* :ghpull:`24819`: Bump pypa/cibuildwheel from 2.11.3 to 2.11.4 +* :ghpull:`24811`: removed casting handles to list in legend +* :ghpull:`24759`: Reverse legend +* :ghpull:`24465`: Reparametrize offsetbox calculations in terms of bboxes. +* :ghpull:`22316`: Arbitrary figure customization hooks. +* :ghpull:`22329`: Enforce that Line data modifications are sequences +* :ghpull:`24730`: Data access API for rcParams +* :ghpull:`24699`: Implement nested four-level TeX cache +* :ghpull:`24752`: DOC: Make event handling table scrollable +* :ghpull:`24637`: Fixes #20044 pass AnnotationBbox to renderer +* :ghpull:`24810`: Don't modify dictionary input to widgets +* :ghpull:`24769`: Improve matplotlib.axes documentation +* :ghpull:`24806`: Deprecate 'x' argument for widgets.TextBox.begin_typing +* :ghpull:`24293`: Handle rasterization start & stop only from Artist +* :ghpull:`24768`: Fix/zorder rasterization +* :ghpull:`24474`: Use scatter for check boxes and set facecolors correctly in check boxes and radio buttons +* :ghpull:`24262`: Fix issue with space allocated for single tick that should not be there +* :ghpull:`24780`: Update environment.yml +* :ghpull:`23576`: Soft deprecate the textpath module (import from text instead) +* :ghpull:`24750`: Fix deprecations of \*Cursor widget event handlers +* :ghpull:`24757`: Allow using masked in ``set_offsets`` +* :ghpull:`21661`: Fix plot directive with func calls +* :ghpull:`24803`: Correct type in docstring of zorder for streamplot and LineCollection +* :ghpull:`24801`: Correct docstring of RangeSlider.on_changed +* :ghpull:`24802`: Correct docstring of CheckButtons.get_status +* :ghpull:`24758`: MNT: Simplify code related to masked arrays +* :ghpull:`24756`: DOC: Simplify some table markup +* :ghpull:`24795`: DOC: Fix duplicate redirect +* :ghpull:`24782`: DOC: update typos and grammar errors +* :ghpull:`24794`: Update README.md +* :ghpull:`24071`: Deprecate undefined label_mode to Grid +* :ghpull:`24724`: Run delvewheel on Windows for wheels +* :ghpull:`24538`: [Doc] Document legend_handles and legend_handlers +* :ghpull:`24751`: DOC: Update Artist inheritance diagram +* :ghpull:`24761`: Don't set the never-used Line2D._contains in set_picker. +* :ghpull:`24760`: Remove unused dicts from backend_cairo. +* :ghpull:`24736`: DOC: simplify CheckButton example +* :ghpull:`22700`: MAINT: Move docstring of ``LogLocator`` to class +* :ghpull:`19763`: Remove visibility changes in draw for \*Cursor widgets +* :ghpull:`23473`: Separately track modifier keys for mouse events. +* :ghpull:`24748`: DOC: remove research notice +* :ghpull:`24734`: Support masked dates +* :ghpull:`24737`: MNT: make fig.colorbar(..., ax=INPUT) even more forgiving +* :ghpull:`24120`: don't try to start a new event loop in WebAgg when in an ipykernel +* :ghpull:`24362`: Allow bool-like values for sharex/sharey +* :ghpull:`24740`: Minor redundancy cleanup of code which sets 3D aspect 3D +* :ghpull:`22273`: Improve inheritance diagrams +* :ghpull:`24668`: Add test for remaining axis options +* :ghpull:`9598`: ENH: rely on non-rectangular patch paths rather than bboxes for legend auto-placing (fix #9580) +* :ghpull:`22920`: Mnt deprecate mlab +* :ghpull:`24408`: Fix: restore make_axes to accept a tuple of axes +* :ghpull:`24731`: DOC: Post warnings as reviews on PRs +* :ghpull:`24652`: Offsetbox default arguments +* :ghpull:`24720`: FIX: be more forgiving in default draw wrapper +* :ghpull:`24719`: Remove quotes from EngFormatter.format_eng example +* :ghpull:`24718`: Remove refresh function from polar ThetaLocator +* :ghpull:`24710`: Drop support for Qt<5.10. +* :ghpull:`24509`: Factor out & improve accuracy of derivatives calculations in axisartist. +* :ghpull:`19591`: reverse order in which stackplot elements are added to axes +* :ghpull:`24367`: STY: Update macosx zoom rect styling +* :ghpull:`24706`: Bump pypa/cibuildwheel from 2.11.2 to 2.11.3 +* :ghpull:`24705`: Cleanup a few examples. +* :ghpull:`21096`: FIX: improve symlog ticker +* :ghpull:`24498`: DOC: Update multiple category bar chart examples +* :ghpull:`24688`: Deprecate quiver_doc and barbs_doc class members +* :ghpull:`24526`: [Doc] Fix spelling and grammar in tutorials +* :ghpull:`24675`: TST: set style in mpl_toolkits to ease later transition +* :ghpull:`24484`: Artist's draw method prevents rasterization by default +* :ghpull:`24667`: Test scroll zoom bbox update +* :ghpull:`24662`: Doc/git force +* :ghpull:`24664`: Deprecate offsetbox.bbox_artist +* :ghpull:`24670`: Tiny capitalization fix. +* :ghpull:`24596`: ENH: Add ellipse class for annotation box styles +* :ghpull:`24249`: Add legend tests for 3D plots +* :ghpull:`24627`: MNT: when clearing an Axes via clear/cla fully detach children +* :ghpull:`24653`: Directly call _long_axis()._set_axes_scale in Colorbar. +* :ghpull:`24640`: Small TransformWrapper cleanups. +* :ghpull:`24528`: BUG: Warn when an existing layout manager changes to tight layout +* :ghpull:`24635`: Remove unneeded _update_transScale calls in _init_axis. +* :ghpull:`24641`: Fix that font files never pass the test on Win +* :ghpull:`24522`: Use pybind11 for tri module +* :ghpull:`24603`: Shorten the definition of sawtooth boxstyle. +* :ghpull:`24630`: Improve error message for gridspec when the index is not an integer. +* :ghpull:`24634`: Init axes._children early enough to avoid need for some getattr calls. +* :ghpull:`24629`: Doc/gitwash redirects +* :ghpull:`24624`: Expire FancyBboxPatch deprecations. +* :ghpull:`24619`: ENH: Allow RGB(A) arrays for pcolormesh +* :ghpull:`23588`: Refactoring gitwash +* :ghpull:`21549`: Unifying the Figure getter/setter interface to match its constructor +* :ghpull:`24582`: Shorten demo_axes_grid example. +* :ghpull:`24577`: Fold _set_ticklabels into set_ticklabels. +* :ghpull:`24581`: Simplify implementation of _is_sorted. +* :ghpull:`24575`: Use std::isnan and fix compiler warning +* :ghpull:`24570`: FIX: VPacker and HPacker bottom/top alignment +* :ghpull:`23812`: Ci add codeql +* :ghpull:`24556`: Fix incorrect window_extent of AxesImage +* :ghpull:`24566`: Improve argument checking for set_xticks(). +* :ghpull:`24544`: DOC: Add links to supported file formats in animations tutorial +* :ghpull:`24511`: Add test for mutating input arrays #8990 +* :ghpull:`24558`: In mplot3d, fix a doc typo and autogen zaxis_inverted. +* :ghpull:`24555`: ENH: Add warning for SymLogScale when values in linear scale range +* :ghpull:`23417`: Consistently set label on axis with units +* :ghpull:`24542`: DOC: Clarify supported animation formats in animation tutorial +* :ghpull:`23685`: Add mathtext support for ``\middle`` and correct rendering of ``\|`` +* :ghpull:`24539`: Fix misnamed api changes entry. +* :ghpull:`23692`: Add ``Axes.get_tick_params()`` method. +* :ghpull:`24132`: CenteredNorm changes +* :ghpull:`24529`: Transform ParasiteAxesBase._update_viewlim into standard callback. +* :ghpull:`24304`: Simplify some patches path definitions. +* :ghpull:`24431`: FIX: Support passing one alpha per event sequence to eventplot() +* :ghpull:`24527`: Fix testing of whether backends use the new pyplot_show API. +* :ghpull:`24537`: Fix triage tool due to test reorganization +* :ghpull:`21831`: FIX: pre-composite animation frames to white background +* :ghpull:`24205`: Plot directive: delegate file handling to Sphinx +* :ghpull:`24274`: Animation Tutorial +* :ghpull:`24519`: MNT: remove unused arguments to private methods and minor doc fixes +* :ghpull:`24525`: [Doc] Fix spelling and grammar in examples +* :ghpull:`24523`: [Doc] fix more spelling and grammar +* :ghpull:`24218`: Document what pyplot expects from a backend. +* :ghpull:`24513`: Modernize a bit floating_axes tests. +* :ghpull:`24491`: Make Path3DCollection store indexed offset, and only apply z-ordered offset during draw +* :ghpull:`24500`: DOC: Removed matplotlib from mission statement title +* :ghpull:`24490`: DOC: Remove text rotation example +* :ghpull:`24487`: Update tests to run with 3.11 (not rc) +* :ghpull:`24439`: Remove custom polar behaviour in LogLocator +* :ghpull:`24461`: Shorten and explain more calculations in axes_divider. +* :ghpull:`24472`: [DOC] removed flake8 from PR template +* :ghpull:`24467`: [DOC] swapped params in fig_compare_error msg +* :ghpull:`24455`: Draw RadioButtons using scatter to ensure circular buttons. +* :ghpull:`24462`: Don't pass unused xdescent to _get_packed_offsets. +* :ghpull:`24446`: Remove axis() manual argument parsing. +* :ghpull:`24334`: ENH: Check labels arg when kwargs passed in Axis.set_ticks() +* :ghpull:`24430`: MNT: Issue a warning instead of logging if RGB(A) passed to scatter(..., c) +* :ghpull:`24397`: Simplify appveyor to only use conda +* :ghpull:`24447`: Factor out error generation for function calls with wrong nargs. +* :ghpull:`24441`: DOC: Fix example for what's new imshow so it isn't cut off or crowded. +* :ghpull:`24443`: Add valid values to ``get_*axis_transform`` docstring +* :ghpull:`24440`: DOC: Fix colorbar what's new entry so it isn't cut off. +* :ghpull:`23787`: Use pybind11 for C/C++ extensions +* :ghpull:`24247`: Split toolkit tests into their toolkits +* :ghpull:`24432`: DOC: Fix What's New entry for bar_label() formatting. +* :ghpull:`23101`: Move show() to somewhere naturally inheritable / document what pyplot expects from a backend. +* :ghpull:`24215`: Add :shows-source-link: option to Sphinx plot directive +* :ghpull:`24423`: Tighten the Qt binding selection docs. +* :ghpull:`24403`: Use ``repr`` in error message Addresses #21959 +* :ghpull:`24415`: made f2tfont error message explicit that it needs path to file +* :ghpull:`24329`: Kill FontconfigPatternParser. +* :ghpull:`23267`: Add location keyword argument to Colorbar +* :ghpull:`24375`: DOC: Group pyplot plotting commands +* :ghpull:`24307`: DOC: Organize Axes3D methods into sections +* :ghpull:`22230`: FIX: add support for imshow extent to have units +* :ghpull:`24252`: Change default rotation mode for 3D labels to 'anchor' +* :ghpull:`24356`: Expire QuadMesh old signature deprecation +* :ghpull:`24355`: Expire unused positional parameters in canvas subclasses +* :ghpull:`24257`: Load style files from third-party packages. +* :ghpull:`24279`: Cleanup BboxImage example. +* :ghpull:`24342`: Use HTML5 for webagg files +* :ghpull:`24339`: DOC: Minor cleanup in "Writing documentation" +* :ghpull:`24338`: DOC: Group pyplot commands by category +* :ghpull:`24314`: Minor improvements to Annotations Tutorial +* :ghpull:`23914`: Add shading of Poly3DCollection +* :ghpull:`24322`: GOV: change security reporting to use tidelift +* :ghpull:`24305`: Unify logic of ConnectionStyle._Base.{_clip,_shrink}. +* :ghpull:`24303`: Simplify generate_fontconfig_pattern. +* :ghpull:`24319`: Bump mamba-org/provision-with-micromamba from 13 to 14 +* :ghpull:`24239`: Fix mathtext rendering of ``\|`` and sizing of ``|`` and ``\|`` +* :ghpull:`23606`: added offset section & restructured annotations tutorial +* :ghpull:`24125`: Expire miscellaneous deprecations from 3.5 +* :ghpull:`24306`: Remove unnecessary/replaceable explicit str calls. +* :ghpull:`24295`: Remove unnecessary np.{,as}array / astype calls. +* :ghpull:`24302`: MNT: Remove redundant int after round +* :ghpull:`24290`: Cleanup Barbs._find_tails. +* :ghpull:`24298`: List all the places to update when adding a dependency. +* :ghpull:`24289`: Cleanup image_zcoord example. +* :ghpull:`23865`: Add test and example for VBoxDivider +* :ghpull:`24287`: Simplifying glyph stream logic in ps backend +* :ghpull:`24291`: Rely on builtin round() instead of manual rounding. +* :ghpull:`24062`: Replaced std::random_shuffle with std::shuffle in tri +* :ghpull:`24278`: Use oldest-supported-numpy for build +* :ghpull:`24161`: Versioning directives policy +* :ghpull:`24013`: Deprecate matplotlib.tri.* submodules +* :ghpull:`24031`: Add rcParams for 3D pane color +* :ghpull:`24220`: Simplify and tighten parse_fontconfig_pattern. +* :ghpull:`24251`: Expire deprecation for ``auto_add_to_figure=True`` in ``Axes3D`` +* :ghpull:`24160`: sample versioning directives, empty + description +* :ghpull:`24253`: Expire deprecation of grid argument name +* :ghpull:`14471`: FIX: don't close figures if switch_backend is a no-op +* :ghpull:`24240`: Deprecate unit_cube-related methods in Axes3D +* :ghpull:`24244`: Clarify that z must be finite for tricountour(f) +* :ghpull:`23536`: Improve mpl_toolkit documentation +* :ghpull:`24243`: Improve documentation for ticker +* :ghpull:`24189`: Do not pass gridspec_kw to inner layouts in subplot_mosaic +* :ghpull:`24242`: Add information about environment variables in matplotlib.__doc__ +* :ghpull:`24241`: Small animation docs/style fixes. +* :ghpull:`24236`: DOC: Mark SubplotBase removals in code style +* :ghpull:`24141`: Set figure options dynamically +* :ghpull:`23796`: Remove useless semicolons in "Introductory / Basic Usage" tutorial +* :ghpull:`23573`: Merge SubplotBase into AxesBase. +* :ghpull:`23931`: Raise ValueError on negative number inputs for set_aspect +* :ghpull:`24065`: Fixed the positioning of cursor in Textbox: no approximation +* :ghpull:`24122`: Add textcolor to legend based on labelcolor string +* :ghpull:`24182`: MNT: Remove redundant method, fix signature and add doc-string to ``draw_tex`` +* :ghpull:`24224`: Deprecate Julian date-related functions and constant +* :ghpull:`24196`: MNT: Update pre-commit hooks +* :ghpull:`24221`: Deprecate BufferRegion.to_string{,_argb}. +* :ghpull:`23683`: Simplify/add pyparsing error messages on mathtext/fontconfig errors. +* :ghpull:`24210`: Small cleanups to axislines docs. +* :ghpull:`24213`: Cleanup make_compound_path_from_poly doc, example. +* :ghpull:`24208`: Deprecate backend_webagg.ServerThread. +* :ghpull:`24207`: Recommend multiple_yaxis_with_spines over parasite axes. +* :ghpull:`24156`: Automatically update rebase label +* :ghpull:`24198`: Deprecate unused backend_ps.{PsBackendHelper,ps_backend_helper}. +* :ghpull:`24129`: Expire cursor-related deprecations +* :ghpull:`24179`: MNT: Refactor ``Renderer.get_text_width_height_descent`` +* :ghpull:`24191`: BLD: be more cautious about checking editable mode +* :ghpull:`24000`: Generalize validation that pyplot commands are documented +* :ghpull:`24144`: Deprecate some label-related attributes on ContourLabeler. +* :ghpull:`24162`: windows doc build parity +* :ghpull:`24102`: Simplest pyproject.toml containing build-system only +* :ghpull:`24091`: MNT: Clean up code in SecondaryAxis +* :ghpull:`24140`: Replace ClabelText by set_transform_rotates_text. +* :ghpull:`24143`: Add QuadContourSet.remove. +* :ghpull:`24138`: [DOC] Fix some documentation typos +* :ghpull:`24128`: Expire deprecations in dates and ticker +* :ghpull:`23907`: Inherit OffsetBox.get_window_extent. +* :ghpull:`23449`: Add pan and zoom toolbar handling to 3D Axes (Replaces PR#22614) +* :ghpull:`24126`: Bump version when invalid hatches error +* :ghpull:`23874`: Expire parameter renaming and deletion and attribute privatization from 3.5 +* :ghpull:`23592`: Polar errcaps +* :ghpull:`24083`: Enable interactive figure resizing for webagg and nbagg backends +* :ghpull:`24110`: test readme rendering +* :ghpull:`24067`: README.rst to README.md +* :ghpull:`23702`: Get Mathtext ``\times`` symbol from ``cmsy10`` when using ``cmr10``. +* :ghpull:`24066`: Simplify svg font expansion logic. +* :ghpull:`23730`: [DOC]: Add grid to style sheets +* :ghpull:`24020`: [DOC]: adding a grid to the style sheet reference. +* :ghpull:`23579`: Remove direct manipulation of HostAxes.parasites by end users. +* :ghpull:`23553`: Add tests for ImageGrid +* :ghpull:`23918`: Merge v3.6.x branch to main +* :ghpull:`23902`: Add test and improve examples for mpl_toolkits +* :ghpull:`23950`: DOC: Don't import doctest because we're not using it +* :ghpull:`21006`: Rotate errorbar caps in polar plots +* :ghpull:`23870`: Implement Sphinx-Gallery's ``make html-noplot`` +* :ghpull:`23905`: made explicit that install link is install docs in readme +* :ghpull:`23824`: Deprecate draw_gouraud_triangle +* :ghpull:`23913`: Add draggable as param to Legend init +* :ghpull:`23896`: Inline AnchoredOffsetBox._update_offset_func. +* :ghpull:`23889`: Update image tutorial. +* :ghpull:`23861`: Move axes_grid tests to axes_grid1 +* :ghpull:`23254`: Add PathCollection test for ps backend +* :ghpull:`23542`: Add even more mplot3d tests +* :ghpull:`23698`: Fix bug in ``Axes.bar_label(label_type='center')`` for non-linear scales. +* :ghpull:`23767`: DEV: add flake8-force plugin +* :ghpull:`23835`: Fix version switcher links +* :ghpull:`23832`: Improve skip message for image comparison tests +* :ghpull:`23690`: Add new-style string formatting option and callable option to ``fmt`` in ``Axes.bar_label()``. +* :ghpull:`23804`: Fix TexManager's support for ``openin_any = p`` +* :ghpull:`23737`: Update grammar +* :ghpull:`23552`: Provide ``adjustable='box'`` to 3D axes aspect ratio setting +* :ghpull:`23769`: Bump mamba-org/provision-with-micromamba from 12 to 13 +* :ghpull:`23590`: Changing bar examples to tea and coffee +* :ghpull:`21253`: Fix: axis, ticks are set to defaults fontsize after ax.clear() +* :ghpull:`21968`: Changed fstring to make error clearer +* :ghpull:`22614`: ENH: Add pan and zoom toolbar handling to 3D Axes +* :ghpull:`21562`: Add a test for Hexbin Linear + +Issues (120): + +* :ghissue:`25176`: [Bug]: Colorbar is displaced when saving as .eps with bbox_inches='tight' +* :ghissue:`25075`: [Bug]: Widget blitting broken when saving as PDF +* :ghissue:`25181`: unavoidable warnings in nbagg on ``plt.close`` +* :ghissue:`25134`: [Doc]: pyplot.boxplot whisker length wrong docs +* :ghissue:`24395`: Any resizing of the plot after plt.show results in an error when closing the window +* :ghissue:`25107`: [Doc]: annotated_cursor example seems broken +* :ghissue:`25124`: [Bug]: ax.plot(x,y) disappears after changing y_scale +* :ghissue:`8278`: FuncAnimation with generator defaults to arbitrary save_count=100 +* :ghissue:`22765`: Document distutil vs setuptools issues or fix usage +* :ghissue:`25077`: [Bug]: Setting norm with existing colorbar fails with 3.6.3 +* :ghissue:`23999`: [Bug]: Annotation misplaced when rasterizing and saving as PDF +* :ghissue:`25040`: [Bug]: Request to insecure websocket endpoint is blocked by browser +* :ghissue:`24678`: [Bug]: pcolormesh doesn't allow shading = 'flat' in the option +* :ghissue:`15388`: matplotlib.collections.QuadMesh.set_array() input arg format is weird and undocumented +* :ghissue:`23779`: [ENH]: control the size of the tex cache +* :ghissue:`24583`: [ENH]: provide public API for styling radio buttons +* :ghissue:`21895`: [Bug]: slow rendering of multiple axes (time scales as 2nd power of label count) +* :ghissue:`4781`: Add API to register styles +* :ghissue:`24972`: [MNT]: UserWarning from pyparsing upon immediate import +* :ghissue:`24865`: [Bug]: NumPy 1.24 deprecation warnings +* :ghissue:`24954`: [Bug]: compressed layout setting can be forgotten on second save +* :ghissue:`23778`: [ENH]: Allow override of contour level autoscaling +* :ghissue:`20203`: contour edge case with all data below levels and a surrounding field of zeros +* :ghissue:`12803`: pcolormesh in log polar coordinates +* :ghissue:`24383`: log scale and polar broken +* :ghissue:`22847`: [Bug]: Cannot toggle set_tight_layout +* :ghissue:`23646`: [Bug]: matplotlib.set_loglevel() adds a console handler +* :ghissue:`24673`: [Doc]: animation examples show controls; source does not reproduce them +* :ghissue:`7617`: set_ylabel does not work as expected with SubplotZero +* :ghissue:`13023`: constrained_layout support for figure.legend +* :ghissue:`15973`: span_where fails with timeseries on the x-axis +* :ghissue:`24867`: [Bug]: controlling text on toolbar in wx +* :ghissue:`24421`: [Doc]: change to install from conda forge +* :ghissue:`24890`: [Bug]: Clipping mask can shift in PDF and SVG file outputs when Bbox is adjusted +* :ghissue:`23849`: [Bug]: The point marker is not actually unfilled +* :ghissue:`24321`: [ENH]: Auto-detect bool arrays passed to contour()? +* :ghissue:`24842`: axes3d.quiver() fails when providing args to Line3DCollection +* :ghissue:`24093`: [Bug]: CenteredNorm gets stuck in infinite recursion when given all zeros +* :ghissue:`24571`: [ENH]: gridspec_mosaic +* :ghissue:`24815`: [TST] Upcoming dependency test failures +* :ghissue:`24712`: [ENH]: Reverse legend +* :ghissue:`22308`: [Bug] set_3d_properties type error in Matplotlib 3.5.1 +* :ghissue:`24741`: [Doc]: tables in "notes" cut off content +* :ghissue:`20044`: AnnotationBbox gid not passed to renderer +* :ghissue:`24762`: [Doc]: Development workflow doc has lots of typos and clunky sentences +* :ghissue:`24235`: [Bug]: pcolormesh(rasterized=True) conflicts with set_rasterization_zorder() +* :ghissue:`24471`: [Bug]: CheckBoxes should be square, not rectangular +* :ghissue:`18804`: bugged pads on savefig +* :ghissue:`20656`: Sphinx extension plot_directive not able to detect function +* :ghissue:`24704`: [Bug]: ImportError: DLL load failed on Windows +* :ghissue:`20639`: document Legend.legendHandles +* :ghissue:`19633`: Multicursor disappears when not moving on nbagg with useblit=False + burns CPU +* :ghissue:`24717`: Update Research Notice on README.md +* :ghissue:`22754`: [Bug]: It is recommended for you to run autogen before configuring freetype +* :ghissue:`24349`: [Bug]: sharex and sharey don't accept 0 and 1 as bool values +* :ghissue:`20577`: Using ``legend(labelcolor="markerfacecolor")`` with a scatter plot throws an error +* :ghissue:`24424`: [Doc]: Inheritance diagrams +* :ghissue:`9580`: Broken legend auto-position with step*-type histograms +* :ghissue:`22176`: [MNT]: Write a bot to post doc build issues +* :ghissue:`24623`: [Bug]: ``offsetbox`` classes have optional arguments that are really not optional +* :ghissue:`24693`: [MNT]: Update minver policy re: GUI toolkits +* :ghissue:`23566`: [ENH]: Z-axis/3D support for Figure options +* :ghissue:`23777`: [ENH] Interactive Zoom Rectangle Color Review for MACOSX backend +* :ghissue:`24676`: [Doc]: quiver_doc etc leads to documentation of the documentation string +* :ghissue:`24568`: [ENH]: Ellipse annotation +* :ghissue:`6982`: cla(), clf() should unset the ``.axes`` and ``.figure`` attributes of deparented artists +* :ghissue:`11227`: fig.set_dpi() does not set the dpi correctly +* :ghissue:`24418`: [ENH]: rgp or rgba option for pyplot pcolormesh and/or pcolor +* :ghissue:`22236`: [Bug]: integer colours for pcolorfast / quadmesh +* :ghissue:`4277`: RGB not supported in pcolormesh +* :ghissue:`23155`: [ENH]: do_3d_projection could restore original verts order after draw() finishes +* :ghissue:`24386`: [Bug]: ``align`` in ``HPacker`` is reversed +* :ghissue:`23803`: Static code analysis +* :ghissue:`8990`: Surprising behaviour of mutating input arrays to Axes.plot vs Axes3D.plot +* :ghissue:`24550`: [ENH]: Warn when a SymLogScale receives values that are all in the linear regime +* :ghissue:`23416`: [Bug]: Inconsistent y-axis unit label with plot/scatter +* :ghissue:`23603`: [MNT]: Only a subset of attributes set via ``Axes.tick_params()`` are accessible via public methods and attributes +* :ghissue:`13858`: matplotlib.sphinxext.plot_directive generates incorrect links when using dirhtml builder +* :ghissue:`19376`: eventplot: allow a list of alpha channels as in the case with colors +* :ghissue:`24508`: [Bug]: Re-organization of mpl_toolkits tests broke tools/triage_tests.py +* :ghissue:`19040`: v3.3.0 Regression, Animation draws artists multiple times. +* :ghissue:`12324`: DOC: Write a unified backend doc +* :ghissue:`24464`: Issue with legend labelcolor='linecolor' for errorbar plots +* :ghissue:`24273`: [ENH]: Axes.set_xticks/Axis.set_ticks only validates kwargs if ticklabels are set, but they should +* :ghissue:`24454`: [Bug]: "import matplotlib.pyplot" gives ModuleNotFoundError +* :ghissue:`24394`: [TST]: Appveyor Qt tests failing +* :ghissue:`21959`: [ENH]: Use ``repr`` instead of ``str`` in the error message +* :ghissue:`22676`: [ENH]: Colorbar should support location kwarg that sets both orientation and ticklocation +* :ghissue:`23901`: [Doc]: add summary table to Axes3D similar to Axes +* :ghissue:`22105`: [Bug]: imshow extents can't have units? +* :ghissue:`21878`: [MNT]: make axis labels of 3d axis anchor-rotate +* :ghissue:`17978`: Document how to distribute style files in python packages +* :ghissue:`23965`: Simplify glyph stream logic in ps backend +* :ghissue:`19509`: Adding lightsource when plotting Poly3DCollection +* :ghissue:`17523`: Unclear if no gallery argument for doc builds works +* :ghissue:`23250`: [Bug]: Incorrect mathtext rendering of ``r"$\|$"`` with default (dejavu) math fontfamily +* :ghissue:`24010`: c++17 removed random_shuffle +* :ghissue:`20424`: function shadowing their own definition modules +* :ghissue:`20781`: Make the pane color in 3d plots configurable +* :ghissue:`14426`: Existing FigureCanvasQT objects destroyed by call to plt.figure +* :ghissue:`5908`: Unclear Documentation ticker class +* :ghissue:`24099`: [Bug]: Error using width_ratios with nested mosaic in subplot_mosaic() +* :ghissue:`6893`: List environment variables in matplotlib.__doc__ +* :ghissue:`11445`: The axes module structure +* :ghissue:`23847`: [Bug]: set_aspect with negative argument leads to infinite loop +* :ghissue:`24136`: [Doc]: document ``julian2num`` and ``num2julian``? +* :ghissue:`5332`: QuadContourSet lacks remove method +* :ghissue:`110`: pan and zoom are broken for mplot3d +* :ghissue:`441`: Polar plot error bars don't rotate with angle +* :ghissue:`24064`: Convert readme.rst to readme.md +* :ghissue:`10029`: \times in minor ticklabels not recognized due to \mathdefault +* :ghissue:`24080`: verify quoting method in svg backend for font names +* :ghissue:`23601`: [Doc]: add gridlines to style sheet reference +* :ghissue:`24075`: [ENH]: Resizing the figure with webagg backend by dragging the corner +* :ghissue:`23352`: [Doc]: bar examples should probably not have "score by ... gender" in them... +* :ghissue:`23819`: [MNT]: Make draw_gouraud_triangle optional +* :ghissue:`9181`: legend draggable as keyword +* :ghissue:`23688`: [Bug]: ``Axes.bar_label()`` on log scale does not center the label. +* :ghissue:`23689`: [ENH]: Add f-string formatting to labels in ``Axes.bar_label()`` +* :ghissue:`23718`: [Bug]: Installing from source fails during Freetype compilation with spaces in working directory filepath diff --git a/doc/users/prev_whats_new/whats_new_3.6.0.rst b/doc/users/prev_whats_new/whats_new_3.6.0.rst index b7bb958d67ad..79706376a870 100644 --- a/doc/users/prev_whats_new/whats_new_3.6.0.rst +++ b/doc/users/prev_whats_new/whats_new_3.6.0.rst @@ -13,7 +13,6 @@ the :ref:`github-stats`. Figure and Axes creation / management ===================================== - ``subplots``, ``subplot_mosaic`` accept *height_ratios* and *width_ratios* arguments ------------------------------------------------------------------------------------ @@ -22,6 +21,7 @@ The relative width and height of columns and rows in `~.Figure.subplots` and *width_ratios* keyword arguments to the methods: .. plot:: + :alt: A figure with three subplots in three rows and one column. The height of the subplot in the first row is three times than the subplots in the 2nd and 3rd row. :include-source: true fig = plt.figure() @@ -58,6 +58,7 @@ With ``layout='tight'`` or ``'constrained'``, Axes with a fixed aspect ratio can leave large gaps between each other: .. plot:: + :alt: A figure labelled "fixed-aspect plots, layout=constrained". Figure has subplots displayed in 2 rows and 2 columns; Subplots have large gaps between each other. fig, axs = plt.subplots(2, 2, figsize=(5, 3), sharex=True, sharey=True, layout="constrained") @@ -69,6 +70,7 @@ Using the ``layout='compressed'`` layout reduces the space between the Axes, and adds the extra space to the outer margins: .. plot:: + :alt: Four identical two by two heatmaps, each cell a different color: purple, blue, yellow, green going clockwise from upper left corner. The four heatmaps are laid out in a two by two grid with minimum white space between the heatmaps. fig, axs = plt.subplots(2, 2, figsize=(5, 3), sharex=True, sharey=True, layout='compressed') @@ -96,6 +98,7 @@ with the previous layout engine. may be returned. .. plot:: + :alt: Plot of a straight line y=x, with a small inset axes in the lower right corner that shows a circle with radial grid lines and a line plotted in polar coordinates. :include-source: true fig, ax = plt.subplots() @@ -147,6 +150,7 @@ The new *gapcolor* parameter to `~.Axes.plot` enables the creation of striped lines. .. plot:: + :alt: Plot of x**3 where the line is an orange-blue striped line, achieved using the keywords linestyle='--', color='orange', gapcolor='blue' :include-source: true x = np.linspace(1., 3., 10) @@ -164,6 +168,7 @@ The new *capwidths* parameter to `~.Axes.bxp` and `~.Axes.boxplot` allows controlling the widths of the caps in box and whisker plots. .. plot:: + :alt: A box plot with capwidths 0.01 and 0.2 :include-source: true x = np.linspace(-7, 7, 140) @@ -184,6 +189,7 @@ label entries, so this is best used when bars also differ in style (e.g., by passing a list to *color*, as below.) .. plot:: + :alt: Bar chart: blue bar height 10, orange bar height 20, green bar height 15 legend with blue box labeled a, orange box labeled b, and green box labeled c :include-source: true x = ["a", "b", "c"] @@ -214,6 +220,7 @@ The line style of negative contours may be set by passing the only be set globally via :rc:`contour.negative_linestyles`. .. plot:: + :alt: Two contour plots, each showing two positive and two negative contours. The positive contours are shown in solid black lines in both plots. In one plot the negative contours are shown in dashed lines, which is the current styling. In the other plot they're shown in dotted lines, which is one of the new options. :include-source: true delta = 0.025 @@ -273,6 +280,7 @@ passed to `.Line2D`, rather than claiming that all keyword arguments are passed on. .. plot:: + :alt: Graph with error bar showing ±0.2 error on the x-axis, and ±0.4 error on the y-axis. Error bar marker is a circle radius 20. Error bar face color is blue. :include-source: true x = np.arange(0.1, 4, 0.5) @@ -293,7 +301,8 @@ streamlines. Previously streamlines would end to limit the number of lines within a single grid cell. See the difference between the plots below: .. plot:: - + :alt: A figure with two streamplots. First streamplot has broken streamlines. Second streamplot has continuous streamlines. + w = 3 Y, X = np.mgrid[-w:w:100j, -w:w:100j] U = -1 - X**2 + Y @@ -317,6 +326,7 @@ the scale. This is based on an arcsinh transformation that allows plotting both positive and negative values that span many orders of magnitude. .. plot:: + :alt: Figure with 2 subplots. Subplot on the left uses symlog scale on the y axis. The transition at -2 is not smooth. Subplot on the right use asinh scale. The transition at -2 is smooth. fig, (ax0, ax1) = plt.subplots(1, 2, sharex=True) x = np.linspace(-3, 6, 100) @@ -361,6 +371,7 @@ The rotation point of the `~matplotlib.patches.Rectangle` can now be set to 'xy', 'center' or a 2-tuple of numbers using the *rotation_point* argument. .. plot:: + :alt: Blue square that isn't rotated. Green square rotated 45 degrees relative to center. Orange square rotated 45 degrees relative to lower right corner. Red square rotated 45 degrees relative to point in upper right quadrant. fig, ax = plt.subplots() @@ -437,6 +448,7 @@ It is now possible to set or get minor ticks using `.pyplot.xticks` and `.pyplot.yticks` by setting ``minor=True``. .. plot:: + :alt: Plot showing a line from 1,2 to 3.5,-0.5. X axis showing the 1, 2 and 3 minor ticks on the x axis as One, Zwei, Trois. :include-source: true plt.figure() @@ -456,6 +468,7 @@ the keyword argument *alignment*. You can also use `.Legend.set_alignment` to control the alignment on existing Legends. .. plot:: + :alt: Figure with 3 subplots. All the subplots are titled test. The three subplots have legends titled alignment='left', alignment='center', alignment='right'. The legend texts are respectively aligned left, center and right. :include-source: true fig, axs = plt.subplots(3, 1) @@ -489,6 +502,7 @@ for the user to supply a transformation to be applied to the marker (e.g. a rotation). .. plot:: + :alt: Three rows of markers, columns are blue, green, and purple. First row is y-shaped markers with different capstyles: butt, end is squared off at endpoint; projecting, end is squared off at short distance from endpoint; round, end is rounded. Second row is star-shaped markers with different join styles: miter, star points are sharp triangles; round, star points are rounded; bevel, star points are beveled. Last row shows stars rotated at different angles: small star rotated 0 degrees - top point vertical; medium star rotated 45 degrees - top point tilted right; large star rotated 90 degrees - top point tilted left. :include-source: true from matplotlib.markers import CapStyle, JoinStyle, MarkerStyle @@ -593,6 +607,7 @@ weight can be set separately from the figure title using :rc:`figure.labelsize` and :rc:`figure.labelweight`. .. plot:: + :alt: A figure with 4 plots organised in 2 rows and 2 columns. The title of the figure is suptitle in bold and 64 points. The x axis is labelled supxlabel, and y axis is labelled subylabel. Both labels are 32 points and bold. :include-source: true # Original (previously combined with below) rcParams: @@ -660,6 +675,7 @@ The focal length can be calculated from a desired FOV via the equation: focal\_length = 1/\tan(FOV/2) .. plot:: + :alt: A figure showing 3 basic 3D Wireframe plots. From left to right, the plots use focal length of 0.2, 1 and infinity. Focal length between 0.2 and 1 produce plot with depth while focal length between 1 and infinity show relatively flattened image. :include-source: true from mpl_toolkits.mplot3d import axes3d @@ -685,6 +701,7 @@ programmatically. The default roll angle of 0 is backwards-compatible with existing 3D plots. .. plot:: + :alt: View of a wireframe of a 3D contour that is somewhat a thickened s shape. Elevation and azimuth are 0 degrees so the shape is viewed straight on, but tilted because the roll is 30 degrees. :include-source: true from mpl_toolkits.mplot3d import axes3d @@ -704,6 +721,7 @@ Users can set the aspect ratio for the X, Y, Z axes of a 3D plot to be 'equal', 'equalxy', 'equalxz', or 'equalyz' rather than the default of 'auto'. .. plot:: + :alt: Five plots, each showing a different aspect option for a rectangle that has height 4, depth 1, and width 1. auto: none of the dimensions have equal aspect, depth and width form a rectangular and height appears shrunken in proportion. equal: all the dimensions have equal aspect. equalxy: width and depth equal, height not so looks shrunken in proportion. equalyz: depth and height equal, width not so elongated. equalxz: width and height equal, depth not so elongated. :include-source: true from itertools import combinations, product diff --git a/doc/users/prev_whats_new/whats_new_3.7.0.rst b/doc/users/prev_whats_new/whats_new_3.7.0.rst index af464da50969..96ac42be38f2 100644 --- a/doc/users/prev_whats_new/whats_new_3.7.0.rst +++ b/doc/users/prev_whats_new/whats_new_3.7.0.rst @@ -383,6 +383,7 @@ Additional custom styling of button widgets may be achieved via the *label_props*, *frame_props*, and *check_props* arguments to `.CheckButtons`. .. plot:: + :include-source: true from matplotlib.widgets import CheckButtons, RadioButtons diff --git a/doc/users/project/citing.rst b/doc/users/project/citing.rst index 74f9fe13b56f..6c01fb81a350 100644 --- a/doc/users/project/citing.rst +++ b/doc/users/project/citing.rst @@ -29,6 +29,9 @@ By version .. START OF AUTOGENERATED +v3.7.0 + .. image:: ../../_static/zenodo_cache/7637593.svg + :target: https://doi.org/10.5281/zenodo.7637593 v3.6.3 .. image:: ../../_static/zenodo_cache/7527665.svg :target: https://doi.org/10.5281/zenodo.7527665 diff --git a/doc/users/release_notes.rst b/doc/users/release_notes.rst index cf41d6de8a06..55264842ecd4 100644 --- a/doc/users/release_notes.rst +++ b/doc/users/release_notes.rst @@ -7,7 +7,7 @@ Release notes ============= .. include from another document so that it's easy to exclude this for releases -.. include:: release_notes_next.rst +.. .. include:: release_notes_next.rst Version 3.7 @@ -18,6 +18,7 @@ Version 3.7 prev_whats_new/whats_new_3.7.0.rst ../api/prev_api_changes/api_changes_3.7.0.rst github_stats.rst + prev_whats_new/github_stats_3.7.0.rst Version 3.6 diff --git a/examples/axisartist/simple_axisartist1.py b/examples/axisartist/simple_axisartist1.py index 95d710cbe0b1..ed7d02d8f66b 100644 --- a/examples/axisartist/simple_axisartist1.py +++ b/examples/axisartist/simple_axisartist1.py @@ -18,7 +18,7 @@ import numpy as np -fig = plt.figure(figsize=(6, 3), constrained_layout=True) +fig = plt.figure(figsize=(6, 3), layout="constrained") # To construct axes of two different classes, we need to use gridspec (or # MATLAB-style add_subplot calls). gs = fig.add_gridspec(1, 2) diff --git a/examples/event_handling/lasso_demo.py b/examples/event_handling/lasso_demo.py index cb9412079330..174c05a22cc6 100644 --- a/examples/event_handling/lasso_demo.py +++ b/examples/event_handling/lasso_demo.py @@ -57,7 +57,10 @@ def __init__(self, ax, data): ax.add_collection(self.collection) - self.cid = self.canvas.mpl_connect('button_press_event', self.on_press) + self.cid_press = self.canvas.mpl_connect('button_press_event', + self.on_press) + self.cid_release = self.canvas.mpl_connect('button_release_event', + self.on_release) def callback(self, verts): facecolors = self.collection.get_facecolors() @@ -70,7 +73,6 @@ def callback(self, verts): facecolors[i] = Datum.colorout self.canvas.draw_idle() - self.canvas.widgetlock.release(self.lasso) del self.lasso def on_press(self, event): @@ -84,6 +86,10 @@ def on_press(self, event): # acquire a lock on the widget drawing self.canvas.widgetlock(self.lasso) + def on_release(self, event): + if hasattr(self, 'lasso') and self.canvas.widgetlock.isowner(self.lasso): + self.canvas.widgetlock.release(self.lasso) + if __name__ == '__main__': diff --git a/examples/images_contours_and_fields/contourf_demo.py b/examples/images_contours_and_fields/contourf_demo.py index d7b1bbe9c284..3a3f2b9564df 100644 --- a/examples/images_contours_and_fields/contourf_demo.py +++ b/examples/images_contours_and_fields/contourf_demo.py @@ -40,7 +40,7 @@ # a good idea, because they don't occur on nice boundaries, but we do it here # for purposes of illustration. -fig1, ax2 = plt.subplots(constrained_layout=True) +fig1, ax2 = plt.subplots(layout='constrained') CS = ax2.contourf(X, Y, Z, 10, cmap=plt.cm.bone, origin=origin) # Note that in the following, we explicitly pass in a subset of the contour @@ -66,7 +66,7 @@ # Now make a contour plot with the levels specified, and with the colormap # generated automatically from a list of colors. -fig2, ax2 = plt.subplots(constrained_layout=True) +fig2, ax2 = plt.subplots(layout='constrained') levels = [-1.5, -1, -0.5, 0, 0.5, 1] CS3 = ax2.contourf(X, Y, Z, levels, colors=('r', 'g', 'b'), @@ -101,7 +101,7 @@ # no effect: # cmap.set_bad("red") -fig, axs = plt.subplots(2, 2, constrained_layout=True) +fig, axs = plt.subplots(2, 2, layout="constrained") for ax, extend in zip(axs.flat, extends): cs = ax.contourf(X, Y, Z, levels, cmap=cmap, extend=extend, origin=origin) diff --git a/examples/images_contours_and_fields/image_antialiasing.py b/examples/images_contours_and_fields/image_antialiasing.py index 0ada6251b653..eb8c431f8d96 100644 --- a/examples/images_contours_and_fields/image_antialiasing.py +++ b/examples/images_contours_and_fields/image_antialiasing.py @@ -66,7 +66,7 @@ # original colormap, so it is no longer possible to invert individual # pixels back to their data value. -fig, axs = plt.subplots(2, 2, figsize=(5, 6), constrained_layout=True) +fig, axs = plt.subplots(2, 2, figsize=(5, 6), layout='constrained') axs[0, 0].imshow(a, interpolation='nearest', cmap='RdBu_r') axs[0, 0].set_xlim(100, 200) axs[0, 0].set_ylim(275, 175) @@ -104,7 +104,7 @@ # Apart from the default 'hanning' antialiasing, `~.Axes.imshow` supports a # number of different interpolation algorithms, which may work better or # worse depending on the pattern. -fig, axs = plt.subplots(1, 2, figsize=(7, 4), constrained_layout=True) +fig, axs = plt.subplots(1, 2, figsize=(7, 4), layout='constrained') for ax, interp in zip(axs, ['hanning', 'lanczos']): ax.imshow(a, interpolation=interp, cmap='gray') ax.set_title(f"interpolation='{interp}'") diff --git a/examples/images_contours_and_fields/image_nonuniform.py b/examples/images_contours_and_fields/image_nonuniform.py index 2b0c4fb8a798..80554673eff3 100644 --- a/examples/images_contours_and_fields/image_nonuniform.py +++ b/examples/images_contours_and_fields/image_nonuniform.py @@ -25,7 +25,7 @@ z = np.sqrt(x[np.newaxis, :]**2 + y[:, np.newaxis]**2) -fig, axs = plt.subplots(nrows=2, ncols=2, constrained_layout=True) +fig, axs = plt.subplots(nrows=2, ncols=2, layout='constrained') fig.suptitle('NonUniformImage class', fontsize='large') ax = axs[0, 0] im = NonUniformImage(ax, interpolation=interp, extent=(-4, 4, -4, 4), diff --git a/examples/images_contours_and_fields/pcolormesh_grids.py b/examples/images_contours_and_fields/pcolormesh_grids.py index 7fc75f8b6dd9..7faaf3a86696 100644 --- a/examples/images_contours_and_fields/pcolormesh_grids.py +++ b/examples/images_contours_and_fields/pcolormesh_grids.py @@ -89,7 +89,7 @@ def _annotate(ax, x, y, title): # to use, in this case ``shading='auto'`` will decide whether to use 'flat' or # 'nearest' shading based on the shapes of *X*, *Y* and *Z*. -fig, axs = plt.subplots(2, 1, constrained_layout=True) +fig, axs = plt.subplots(2, 1, layout='constrained') ax = axs[0] x = np.arange(ncols) y = np.arange(nrows) @@ -110,7 +110,7 @@ def _annotate(ax, x, y, title): # be specified, where the color in the quadrilaterals is linearly interpolated # between the grid points. The shapes of *X*, *Y*, *Z* must be the same. -fig, ax = plt.subplots(constrained_layout=True) +fig, ax = plt.subplots(layout='constrained') x = np.arange(ncols) y = np.arange(nrows) ax.pcolormesh(x, y, Z, shading='gouraud', vmin=Z.min(), vmax=Z.max()) diff --git a/examples/lines_bars_and_markers/barchart.py b/examples/lines_bars_and_markers/barchart.py index f5ee6833a881..da30bbf75937 100644 --- a/examples/lines_bars_and_markers/barchart.py +++ b/examples/lines_bars_and_markers/barchart.py @@ -23,7 +23,7 @@ width = 0.25 # the width of the bars multiplier = 0 -fig, ax = plt.subplots(constrained_layout=True) +fig, ax = plt.subplots(layout='constrained') for attribute, measurement in penguin_means.items(): offset = width * multiplier diff --git a/examples/lines_bars_and_markers/curve_error_band.py b/examples/lines_bars_and_markers/curve_error_band.py index e55b467849a8..4d0e09482b31 100644 --- a/examples/lines_bars_and_markers/curve_error_band.py +++ b/examples/lines_bars_and_markers/curve_error_band.py @@ -63,8 +63,7 @@ def draw_error_band(ax, x, y, err, **kwargs): ax.add_patch(PathPatch(path, **kwargs)) -axs = (plt.figure(constrained_layout=True) - .subplots(1, 2, sharex=True, sharey=True)) +_, axs = plt.subplots(1, 2, layout='constrained', sharex=True, sharey=True) errs = [ (axs[0], "constant error", 0.05), (axs[1], "variable error", 0.05 * np.sin(2 * t) ** 2 + 0.04), diff --git a/examples/lines_bars_and_markers/fill_between_demo.py b/examples/lines_bars_and_markers/fill_between_demo.py index 79aef67ab4d9..2da1f682835b 100644 --- a/examples/lines_bars_and_markers/fill_between_demo.py +++ b/examples/lines_bars_and_markers/fill_between_demo.py @@ -52,7 +52,7 @@ x = np.linspace(0, 10, 11) y = [3.9, 4.4, 10.8, 10.3, 11.2, 13.1, 14.1, 9.9, 13.9, 15.1, 12.5] -# fit a linear curve an estimate its y-values and their error. +# fit a linear curve and estimate its y-values and their error. a, b = np.polyfit(x, y, deg=1) y_est = a * x + b y_err = x.std() * np.sqrt(1/len(x) + diff --git a/examples/lines_bars_and_markers/gradient_bar.py b/examples/lines_bars_and_markers/gradient_bar.py index 93d346941f31..1c61a4bb908e 100644 --- a/examples/lines_bars_and_markers/gradient_bar.py +++ b/examples/lines_bars_and_markers/gradient_bar.py @@ -15,15 +15,15 @@ A similar approach can be used to create a gradient background for an Axes. In that case, it is helpful to use Axes coordinates (``extent=(0, 1, 0, 1), transform=ax.transAxes``) to be independent of the data coordinates. - """ + import matplotlib.pyplot as plt import numpy as np np.random.seed(19680801) -def gradient_image(ax, extent, direction=0.3, cmap_range=(0, 1), **kwargs): +def gradient_image(ax, direction=0.3, cmap_range=(0, 1), **kwargs): """ Draw a gradient image based on a colormap. @@ -31,10 +31,6 @@ def gradient_image(ax, extent, direction=0.3, cmap_range=(0, 1), **kwargs): ---------- ax : Axes The axes to draw on. - extent - The extent of the image as (xmin, xmax, ymin, ymax). - By default, this is in Axes coordinates but may be - changed using the *transform* keyword argument. direction : float The direction of the gradient. This is a number in range 0 (=vertical) to 1 (=horizontal). @@ -43,7 +39,7 @@ def gradient_image(ax, extent, direction=0.3, cmap_range=(0, 1), **kwargs): used for the gradient, where the complete colormap is (0, 1). **kwargs Other parameters are passed on to `.Axes.imshow()`. - In particular useful is *cmap*. + In particular, *cmap*, *extent*, and *transform* may be useful. """ phi = direction * np.pi / 2 v = np.array([np.cos(phi), np.sin(phi)]) @@ -51,8 +47,8 @@ def gradient_image(ax, extent, direction=0.3, cmap_range=(0, 1), **kwargs): [v @ [0, 0], v @ [0, 1]]]) a, b = cmap_range X = a + (b - a) / X.max() * X - im = ax.imshow(X, extent=extent, interpolation='bicubic', - vmin=0, vmax=1, **kwargs) + im = ax.imshow(X, interpolation='bicubic', clim=(0, 1), + aspect='auto', **kwargs) return im @@ -63,11 +59,8 @@ def gradient_bar(ax, x, y, width=0.5, bottom=0): cmap=plt.cm.Blues_r, cmap_range=(0, 0.8)) -xmin, xmax = xlim = 0, 10 -ymin, ymax = ylim = 0, 1 - fig, ax = plt.subplots() -ax.set(xlim=xlim, ylim=ylim, autoscale_on=False) +ax.set(xlim=(0, 10), ylim=(0, 1)) # background image gradient_image(ax, direction=1, extent=(0, 1, 0, 1), transform=ax.transAxes, @@ -77,5 +70,4 @@ def gradient_bar(ax, x, y, width=0.5, bottom=0): x = np.arange(N) + 0.15 y = np.random.rand(N) gradient_bar(ax, x, y, width=0.7) -ax.set_aspect('auto') plt.show() diff --git a/examples/lines_bars_and_markers/markevery_demo.py b/examples/lines_bars_and_markers/markevery_demo.py index 8dc02f52e28a..d385515043d5 100644 --- a/examples/lines_bars_and_markers/markevery_demo.py +++ b/examples/lines_bars_and_markers/markevery_demo.py @@ -44,7 +44,7 @@ # markevery with linear scales # ---------------------------- -fig, axs = plt.subplots(3, 3, figsize=(10, 6), constrained_layout=True) +fig, axs = plt.subplots(3, 3, figsize=(10, 6), layout='constrained') for ax, markevery in zip(axs.flat, cases): ax.set_title(f'markevery={markevery}') ax.plot(x, y, 'o', ls='-', ms=4, markevery=markevery) @@ -58,7 +58,7 @@ # fraction of figure size creates even distributions, because it's based on # fractions of the Axes diagonal, not on data coordinates or data indices. -fig, axs = plt.subplots(3, 3, figsize=(10, 6), constrained_layout=True) +fig, axs = plt.subplots(3, 3, figsize=(10, 6), layout='constrained') for ax, markevery in zip(axs.flat, cases): ax.set_title(f'markevery={markevery}') ax.set_xscale('log') @@ -75,7 +75,7 @@ # diagonal, it changes the displayed data range, and more points will be # displayed when zooming. -fig, axs = plt.subplots(3, 3, figsize=(10, 6), constrained_layout=True) +fig, axs = plt.subplots(3, 3, figsize=(10, 6), layout='constrained') for ax, markevery in zip(axs.flat, cases): ax.set_title(f'markevery={markevery}') ax.plot(x, y, 'o', ls='-', ms=4, markevery=markevery) @@ -89,7 +89,7 @@ r = np.linspace(0, 3.0, 200) theta = 2 * np.pi * r -fig, axs = plt.subplots(3, 3, figsize=(10, 6), constrained_layout=True, +fig, axs = plt.subplots(3, 3, figsize=(10, 6), layout='constrained', subplot_kw={'projection': 'polar'}) for ax, markevery in zip(axs.flat, cases): ax.set_title(f'markevery={markevery}') diff --git a/examples/lines_bars_and_markers/psd_demo.py b/examples/lines_bars_and_markers/psd_demo.py index 0ab038c2991b..b4949019a2d6 100644 --- a/examples/lines_bars_and_markers/psd_demo.py +++ b/examples/lines_bars_and_markers/psd_demo.py @@ -111,7 +111,7 @@ xn = (A * np.sin(2 * np.pi * f * t)).sum(axis=0) xn += 5 * np.random.randn(*t.shape) -fig, (ax0, ax1) = plt.subplots(ncols=2, constrained_layout=True) +fig, (ax0, ax1) = plt.subplots(ncols=2, layout='constrained') yticks = np.arange(-50, 30, 10) yrange = (yticks[0], yticks[-1]) @@ -151,7 +151,7 @@ f = np.array([150, 140]).reshape(-1, 1) xn = (A * np.exp(2j * np.pi * f * t)).sum(axis=0) + 5 * prng.randn(*t.shape) -fig, (ax0, ax1) = plt.subplots(ncols=2, constrained_layout=True) +fig, (ax0, ax1) = plt.subplots(ncols=2, layout='constrained') yticks = np.arange(-50, 30, 10) yrange = (yticks[0], yticks[-1]) diff --git a/examples/lines_bars_and_markers/scatter_hist.py b/examples/lines_bars_and_markers/scatter_hist.py index 29b2f96947a4..7819808261f3 100644 --- a/examples/lines_bars_and_markers/scatter_hist.py +++ b/examples/lines_bars_and_markers/scatter_hist.py @@ -89,7 +89,7 @@ def scatter_hist(x, y, ax, ax_histx, ax_histy): # of the axes. # Create a Figure, which doesn't have to be square. -fig = plt.figure(constrained_layout=True) +fig = plt.figure(layout='constrained') # Create the main axes, leaving 25% of the figure space at the top and on the # right to position marginals. ax = fig.add_gridspec(top=0.75, right=0.75).subplots() diff --git a/examples/lines_bars_and_markers/timeline.py b/examples/lines_bars_and_markers/timeline.py index e13bab115a30..72327f18fc84 100644 --- a/examples/lines_bars_and_markers/timeline.py +++ b/examples/lines_bars_and_markers/timeline.py @@ -68,7 +68,7 @@ int(np.ceil(len(dates)/6)))[:len(dates)] # Create figure and plot a stem plot with the date -fig, ax = plt.subplots(figsize=(8.8, 4), constrained_layout=True) +fig, ax = plt.subplots(figsize=(8.8, 4), layout="constrained") ax.set(title="Matplotlib release dates") ax.vlines(dates, 0, levels, color="tab:red") # The vertical stems. diff --git a/examples/misc/rasterization_demo.py b/examples/misc/rasterization_demo.py index f0188c684fc7..4030587b693a 100644 --- a/examples/misc/rasterization_demo.py +++ b/examples/misc/rasterization_demo.py @@ -44,7 +44,7 @@ xx = x*np.cos(theta) - y*np.sin(theta) # rotate x by -theta yy = x*np.sin(theta) + y*np.cos(theta) # rotate y by -theta -fig, ((ax1, ax2), (ax3, ax4)) = plt.subplots(2, 2, constrained_layout=True) +fig, ((ax1, ax2), (ax3, ax4)) = plt.subplots(2, 2, layout="constrained") # pcolormesh without rasterization ax1.set_aspect(1) diff --git a/examples/scales/asinh_demo.py b/examples/scales/asinh_demo.py index ae13fb1265de..854e634a640f 100644 --- a/examples/scales/asinh_demo.py +++ b/examples/scales/asinh_demo.py @@ -65,7 +65,7 @@ ############################################################################### # Compare "asinh" graphs with different scale parameter "linear_width": -fig2 = plt.figure(constrained_layout=True) +fig2 = plt.figure(layout='constrained') axs = fig2.subplots(1, 3, sharex=True) for ax, (a0, base) in zip(axs, ((0.2, 2), (1.0, 0), (5.0, 10))): ax.set_title(f'linear_width={a0:.3g}') diff --git a/examples/scales/scales.py b/examples/scales/scales.py index 25ec82608f01..803c801b4080 100644 --- a/examples/scales/scales.py +++ b/examples/scales/scales.py @@ -23,8 +23,7 @@ x = np.arange(len(y)) # plot with various axes scales -fig, axs = plt.subplots(3, 2, figsize=(6, 8), - constrained_layout=True) +fig, axs = plt.subplots(3, 2, figsize=(6, 8), layout='constrained') # linear ax = axs[0, 0] diff --git a/examples/shapes_and_collections/hatch_style_reference.py b/examples/shapes_and_collections/hatch_style_reference.py index 5fa13163ff33..1b31f28740a9 100644 --- a/examples/shapes_and_collections/hatch_style_reference.py +++ b/examples/shapes_and_collections/hatch_style_reference.py @@ -16,7 +16,7 @@ import matplotlib.pyplot as plt from matplotlib.patches import Rectangle -fig, axs = plt.subplots(2, 5, constrained_layout=True, figsize=(6.4, 3.2)) +fig, axs = plt.subplots(2, 5, layout='constrained', figsize=(6.4, 3.2)) hatches = ['/', '\\', '|', '-', '+', 'x', 'o', 'O', '.', '*'] @@ -33,7 +33,7 @@ def hatches_plot(ax, h): ############################################################################### # Hatching patterns can be repeated to increase the density. -fig, axs = plt.subplots(2, 5, constrained_layout=True, figsize=(6.4, 3.2)) +fig, axs = plt.subplots(2, 5, layout='constrained', figsize=(6.4, 3.2)) hatches = ['//', '\\\\', '||', '--', '++', 'xx', 'oo', 'OO', '..', '**'] @@ -43,7 +43,7 @@ def hatches_plot(ax, h): ############################################################################### # Hatching patterns can be combined to create additional patterns. -fig, axs = plt.subplots(2, 5, constrained_layout=True, figsize=(6.4, 3.2)) +fig, axs = plt.subplots(2, 5, layout='constrained', figsize=(6.4, 3.2)) hatches = ['/o', '\\|', '|*', '-\\', '+o', 'x*', 'o-', 'O|', 'O.', '*-'] diff --git a/examples/spines/spines.py b/examples/spines/spines.py index 0917fc8c107c..659f9fc3e8c2 100644 --- a/examples/spines/spines.py +++ b/examples/spines/spines.py @@ -23,7 +23,7 @@ y = 2 * np.sin(x) # Constrained layout makes sure the labels don't overlap the axes. -fig, (ax0, ax1, ax2) = plt.subplots(nrows=3, constrained_layout=True) +fig, (ax0, ax1, ax2) = plt.subplots(nrows=3, layout='constrained') ax0.plot(x, y) ax0.set_title('normal spines') diff --git a/examples/statistics/barchart_demo.py b/examples/statistics/barchart_demo.py index 18819ca35b08..d91a093d21cb 100644 --- a/examples/statistics/barchart_demo.py +++ b/examples/statistics/barchart_demo.py @@ -45,7 +45,7 @@ def format_score(score): def plot_student_results(student, scores_by_test, cohort_size): - fig, ax1 = plt.subplots(figsize=(9, 7), constrained_layout=True) + fig, ax1 = plt.subplots(figsize=(9, 7), layout='constrained') fig.canvas.manager.set_window_title('Eldorado K-8 Fitness Chart') ax1.set_title(student.name) diff --git a/examples/statistics/time_series_histogram.py b/examples/statistics/time_series_histogram.py index a22ceb4e24d4..d35b6393504e 100644 --- a/examples/statistics/time_series_histogram.py +++ b/examples/statistics/time_series_histogram.py @@ -31,7 +31,7 @@ import matplotlib.pyplot as plt from matplotlib.colors import LogNorm -fig, axes = plt.subplots(nrows=3, figsize=(6, 8), constrained_layout=True) +fig, axes = plt.subplots(nrows=3, figsize=(6, 8), layout='constrained') # Make some data; a 1D random walk + small fraction of sine waves num_series = 1000 diff --git a/examples/style_sheets/style_sheets_reference.py b/examples/style_sheets/style_sheets_reference.py index 90e5812a30b8..8557cc10a203 100644 --- a/examples/style_sheets/style_sheets_reference.py +++ b/examples/style_sheets/style_sheets_reference.py @@ -116,7 +116,7 @@ def plot_figure(style_label=""): prng = np.random.RandomState(96917002) fig, axs = plt.subplots(ncols=6, nrows=1, num=style_label, - figsize=(14.8, 2.8), constrained_layout=True) + figsize=(14.8, 2.8), layout='constrained') # make a suptitle, in the same style for all subfigures, # except those with dark backgrounds, which get a lighter color: diff --git a/examples/subplots_axes_and_figures/axes_box_aspect.py b/examples/subplots_axes_and_figures/axes_box_aspect.py index 019c7e43c787..089f84c26eea 100644 --- a/examples/subplots_axes_and_figures/axes_box_aspect.py +++ b/examples/subplots_axes_and_figures/axes_box_aspect.py @@ -74,10 +74,10 @@ # height. `~.Axes.set_box_aspect` provides an easy solution to that by allowing # to have the normal plot's axes use the images dimensions as box aspect. # -# This example also shows that ``constrained_layout`` interplays nicely with +# This example also shows that *constrained layout* interplays nicely with # a fixed box aspect. -fig4, (ax, ax2) = plt.subplots(ncols=2, constrained_layout=True) +fig4, (ax, ax2) = plt.subplots(ncols=2, layout="constrained") np.random.seed(19680801) # Fixing random state for reproducibility im = np.random.rand(16, 27) @@ -139,7 +139,7 @@ # following creates a 2 by 3 subplot grid with all square Axes. fig7, axs = plt.subplots(2, 3, subplot_kw=dict(box_aspect=1), - sharex=True, sharey=True, constrained_layout=True) + sharex=True, sharey=True, layout="constrained") for i, ax in enumerate(axs.flat): ax.scatter(i % 3, -((i // 3) - 0.5)*200, c=[plt.cm.hsv(i / 6)], s=300) diff --git a/examples/subplots_axes_and_figures/colorbar_placement.py b/examples/subplots_axes_and_figures/colorbar_placement.py index 66e267ce6d43..7bd952247637 100644 --- a/examples/subplots_axes_and_figures/colorbar_placement.py +++ b/examples/subplots_axes_and_figures/colorbar_placement.py @@ -41,9 +41,9 @@ ###################################################################### # Relatively complicated colorbar layouts are possible using this # paradigm. Note that this example works far better with -# ``constrained_layout=True`` +# ``layout='constrained'`` -fig, axs = plt.subplots(3, 3, constrained_layout=True) +fig, axs = plt.subplots(3, 3, layout='constrained') for ax in axs.flat: pcm = ax.pcolormesh(np.random.random((20, 20))) @@ -59,7 +59,7 @@ # Placing colorbars for axes with a fixed aspect ratio pose a particular # challenge as the parent axes changes size depending on the data view. -fig, axs = plt.subplots(2, 2, constrained_layout=True) +fig, axs = plt.subplots(2, 2, layout='constrained') cmaps = ['RdBu_r', 'viridis'] for col in range(2): for row in range(2): @@ -78,7 +78,7 @@ # axes in axes coordinates. Note that if you zoom in on the axes, and # change the shape of the axes, the colorbar will also change position. -fig, axs = plt.subplots(2, 2, constrained_layout=True) +fig, axs = plt.subplots(2, 2, layout='constrained') cmaps = ['RdBu_r', 'viridis'] for col in range(2): for row in range(2): diff --git a/examples/subplots_axes_and_figures/demo_constrained_layout.py b/examples/subplots_axes_and_figures/demo_constrained_layout.py index 26109cbe3129..bf2acd797c76 100644 --- a/examples/subplots_axes_and_figures/demo_constrained_layout.py +++ b/examples/subplots_axes_and_figures/demo_constrained_layout.py @@ -3,7 +3,7 @@ Resizing axes with constrained layout ===================================== -Constrained layout attempts to resize subplots in +*Constrained layout* attempts to resize subplots in a figure so that there are no overlaps between axes objects and labels on the axes. @@ -23,17 +23,17 @@ def example_plot(ax): ############################################################################### -# If we don't use constrained_layout, then labels overlap the axes +# If we don't use *constrained layout*, then labels overlap the axes -fig, axs = plt.subplots(nrows=2, ncols=2, constrained_layout=False) +fig, axs = plt.subplots(nrows=2, ncols=2, layout=None) for ax in axs.flat: example_plot(ax) ############################################################################### -# adding ``constrained_layout=True`` automatically adjusts. +# adding ``layout='constrained'`` automatically adjusts. -fig, axs = plt.subplots(nrows=2, ncols=2, constrained_layout=True) +fig, axs = plt.subplots(nrows=2, ncols=2, layout='constrained') for ax in axs.flat: example_plot(ax) @@ -41,7 +41,7 @@ def example_plot(ax): ############################################################################### # Below is a more complicated example using nested gridspecs. -fig = plt.figure(constrained_layout=True) +fig = plt.figure(layout='constrained') import matplotlib.gridspec as gridspec diff --git a/examples/subplots_axes_and_figures/figure_title.py b/examples/subplots_axes_and_figures/figure_title.py index 0b8a7e2c5855..195bab34d6be 100644 --- a/examples/subplots_axes_and_figures/figure_title.py +++ b/examples/subplots_axes_and_figures/figure_title.py @@ -18,7 +18,7 @@ x = np.linspace(0.0, 5.0, 501) -fig, (ax1, ax2) = plt.subplots(1, 2, constrained_layout=True, sharey=True) +fig, (ax1, ax2) = plt.subplots(1, 2, layout='constrained', sharey=True) ax1.plot(x, np.cos(6*x) * np.exp(-x)) ax1.set_title('damped') ax1.set_xlabel('time (s)') @@ -34,7 +34,7 @@ # A global x- or y-label can be set using the `.FigureBase.supxlabel` and # `.FigureBase.supylabel` methods. -fig, axs = plt.subplots(3, 5, figsize=(8, 5), constrained_layout=True, +fig, axs = plt.subplots(3, 5, figsize=(8, 5), layout='constrained', sharex=True, sharey=True) fname = get_sample_data('percent_bachelors_degrees_women_usa.csv', diff --git a/examples/subplots_axes_and_figures/gridspec_multicolumn.py b/examples/subplots_axes_and_figures/gridspec_multicolumn.py index 5a22aa2d310c..533967b998cb 100644 --- a/examples/subplots_axes_and_figures/gridspec_multicolumn.py +++ b/examples/subplots_axes_and_figures/gridspec_multicolumn.py @@ -17,7 +17,7 @@ def format_axes(fig): ax.text(0.5, 0.5, "ax%d" % (i+1), va="center", ha="center") ax.tick_params(labelbottom=False, labelleft=False) -fig = plt.figure(constrained_layout=True) +fig = plt.figure(layout="constrained") gs = GridSpec(3, 3, figure=fig) ax1 = fig.add_subplot(gs[0, :]) diff --git a/examples/subplots_axes_and_figures/mosaic.py b/examples/subplots_axes_and_figures/mosaic.py index 9b77893bb2d6..3c7a333e22bd 100644 --- a/examples/subplots_axes_and_figures/mosaic.py +++ b/examples/subplots_axes_and_figures/mosaic.py @@ -60,7 +60,7 @@ def identify_axes(ax_dict, fontsize=48): hist_data = np.random.randn(1_500) -fig = plt.figure(constrained_layout=True) +fig = plt.figure(layout="constrained") ax_array = fig.subplots(2, 2, squeeze=False) ax_array[0, 0].bar(["a", "b", "c"], [5, 7, 9]) @@ -76,7 +76,7 @@ def identify_axes(ax_dict, fontsize=48): # Using `.Figure.subplot_mosaic` we can produce the same mosaic but give the # axes semantic names -fig = plt.figure(constrained_layout=True) +fig = plt.figure(layout="constrained") ax_dict = fig.subplot_mosaic( [ ["bar", "plot"], @@ -116,7 +116,7 @@ def identify_axes(ax_dict, fontsize=48): # figure mosaic as above (but now labeled with ``{"A", "B", "C", # "D"}`` rather than ``{"bar", "plot", "hist", "image"}``). -fig = plt.figure(constrained_layout=True) +fig = plt.figure(layout="constrained") ax_dict = fig.subplot_mosaic(mosaic) identify_axes(ax_dict) @@ -128,7 +128,7 @@ def identify_axes(ax_dict, fontsize=48): # will give you the same composition, where the ``";"`` is used # as the row separator instead of newline. -fig = plt.figure(constrained_layout=True) +fig = plt.figure(layout="constrained") ax_dict = fig.subplot_mosaic(mosaic) identify_axes(ax_dict) @@ -145,7 +145,7 @@ def identify_axes(ax_dict, fontsize=48): # If we want to re-arrange our four Axes to have ``"C"`` be a horizontal # span on the bottom and ``"D"`` be a vertical span on the right we would do -axd = plt.figure(constrained_layout=True).subplot_mosaic( +axd = plt.figure(layout="constrained").subplot_mosaic( """ ABD CCD @@ -158,7 +158,7 @@ def identify_axes(ax_dict, fontsize=48): # we can specify some spaces in the grid to be blank -axd = plt.figure(constrained_layout=True).subplot_mosaic( +axd = plt.figure(layout="constrained").subplot_mosaic( """ A.C BBB @@ -173,7 +173,7 @@ def identify_axes(ax_dict, fontsize=48): # to mark the empty space, we can use *empty_sentinel* to specify the # character to use. -axd = plt.figure(constrained_layout=True).subplot_mosaic( +axd = plt.figure(layout="constrained").subplot_mosaic( """ aX Xb @@ -188,7 +188,7 @@ def identify_axes(ax_dict, fontsize=48): # Internally there is no meaning attached to the letters we use, any # Unicode code point is valid! -axd = plt.figure(constrained_layout=True).subplot_mosaic( +axd = plt.figure(layout="constrained").subplot_mosaic( """αб ℝ☢""" ) @@ -212,7 +212,7 @@ def identify_axes(ax_dict, fontsize=48): # `.Figure.subplot_mosaic` calling sequence. -axd = plt.figure(constrained_layout=True).subplot_mosaic( +axd = plt.figure(layout="constrained").subplot_mosaic( """ .a. bAc @@ -265,7 +265,7 @@ def identify_axes(ax_dict, fontsize=48): mosaic = """AA BC""" -fig = plt.figure(constrained_layout=True) +fig = plt.figure(layout="constrained") left, right = fig.subfigures(nrows=1, ncols=2) axd = left.subplot_mosaic(mosaic) identify_axes(axd) @@ -283,7 +283,7 @@ def identify_axes(ax_dict, fontsize=48): # of the Axes created. -axd = plt.figure(constrained_layout=True).subplot_mosaic( +axd = plt.figure(layout="constrained").subplot_mosaic( "AB", subplot_kw={"projection": "polar"} ) identify_axes(axd) @@ -330,7 +330,7 @@ def identify_axes(ax_dict, fontsize=48): # merged with *per_subplot_kw* taking priority: -axd = plt.figure(constrained_layout=True).subplot_mosaic( +axd = plt.figure(layout="constrained").subplot_mosaic( "AB;CD", subplot_kw={"facecolor": "xkcd:tangerine"}, per_subplot_kw={ @@ -349,7 +349,7 @@ def identify_axes(ax_dict, fontsize=48): # passing in a list (internally we convert the string shorthand to a nested # list), for example using spans, blanks, and *gridspec_kw*: -axd = plt.figure(constrained_layout=True).subplot_mosaic( +axd = plt.figure(layout="constrained").subplot_mosaic( [ ["main", "zoom"], ["main", "BLANK"], @@ -373,7 +373,7 @@ def identify_axes(ax_dict, fontsize=48): ["main", inner], ["bottom", "bottom"], ] -axd = plt.figure(constrained_layout=True).subplot_mosaic( +axd = plt.figure(layout="constrained").subplot_mosaic( outer_nested_mosaic, empty_sentinel=None ) identify_axes(axd, fontsize=36) @@ -384,7 +384,7 @@ def identify_axes(ax_dict, fontsize=48): mosaic = np.zeros((4, 4), dtype=int) for j in range(4): mosaic[j, j] = j + 1 -axd = plt.figure(constrained_layout=True).subplot_mosaic( +axd = plt.figure(layout="constrained").subplot_mosaic( mosaic, empty_sentinel=0, ) diff --git a/examples/subplots_axes_and_figures/secondary_axis.py b/examples/subplots_axes_and_figures/secondary_axis.py index a8ba17d3478b..464a88aa1064 100644 --- a/examples/subplots_axes_and_figures/secondary_axis.py +++ b/examples/subplots_axes_and_figures/secondary_axis.py @@ -17,7 +17,7 @@ import matplotlib.dates as mdates from matplotlib.ticker import AutoMinorLocator -fig, ax = plt.subplots(constrained_layout=True) +fig, ax = plt.subplots(layout='constrained') x = np.arange(0, 360, 1) y = np.sin(2 * x * np.pi / 180) ax.plot(x, y) @@ -47,7 +47,7 @@ def rad2deg(x): # In this case, the xscale of the parent is logarithmic, so the child is # made logarithmic as well. -fig, ax = plt.subplots(constrained_layout=True) +fig, ax = plt.subplots(layout='constrained') x = np.arange(0.02, 1, 0.02) np.random.seed(19680801) y = np.random.randn(len(x)) ** 2 @@ -91,7 +91,7 @@ def one_over(x): # arguments *left*, *right* such that values outside the data range are # mapped well outside the plot limits. -fig, ax = plt.subplots(constrained_layout=True) +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') @@ -129,7 +129,7 @@ def inverse(x): dates = [datetime.datetime(2018, 1, 1) + datetime.timedelta(hours=k * 6) for k in range(240)] temperature = np.random.randn(len(dates)) * 4 + 6.7 -fig, ax = plt.subplots(constrained_layout=True) +fig, ax = plt.subplots(layout='constrained') ax.plot(dates, temperature) ax.set_ylabel(r'$T\ [^oC]$') diff --git a/examples/subplots_axes_and_figures/subfigures.py b/examples/subplots_axes_and_figures/subfigures.py index 1e7ae401554b..4a95932fe7f5 100644 --- a/examples/subplots_axes_and_figures/subfigures.py +++ b/examples/subplots_axes_and_figures/subfigures.py @@ -31,7 +31,7 @@ def example_plot(ax, fontsize=12, hide_labels=False): np.random.seed(19680808) # gridspec inside gridspec -fig = plt.figure(constrained_layout=True, figsize=(10, 4)) +fig = plt.figure(layout='constrained', figsize=(10, 4)) subfigs = fig.subfigures(1, 2, wspace=0.07) axsLeft = subfigs[0].subplots(1, 2, sharey=True) @@ -62,7 +62,7 @@ def example_plot(ax, fontsize=12, hide_labels=False): # `matplotlib.figure.Figure.add_subfigure`. This requires getting # the gridspec that the subplots are laid out on. -fig, axs = plt.subplots(2, 3, constrained_layout=True, figsize=(10, 4)) +fig, axs = plt.subplots(2, 3, layout='constrained', figsize=(10, 4)) gridspec = axs[0, 0].get_subplotspec().get_gridspec() # clear the left column for the subfigure: @@ -90,7 +90,7 @@ def example_plot(ax, fontsize=12, hide_labels=False): # Subfigures can have different widths and heights. This is exactly the # same example as the first example, but *width_ratios* has been changed: -fig = plt.figure(constrained_layout=True, figsize=(10, 4)) +fig = plt.figure(layout='constrained', figsize=(10, 4)) subfigs = fig.subfigures(1, 2, wspace=0.07, width_ratios=[2, 1]) axsLeft = subfigs[0].subplots(1, 2, sharey=True) @@ -119,7 +119,7 @@ def example_plot(ax, fontsize=12, hide_labels=False): ############################################################################## # Subfigures can be also be nested: -fig = plt.figure(constrained_layout=True, figsize=(10, 8)) +fig = plt.figure(layout='constrained', figsize=(10, 8)) fig.suptitle('fig') diff --git a/examples/text_labels_and_annotations/angles_on_bracket_arrows.py b/examples/text_labels_and_annotations/angles_on_bracket_arrows.py index 35a6cad22130..f23fe8ff887b 100644 --- a/examples/text_labels_and_annotations/angles_on_bracket_arrows.py +++ b/examples/text_labels_and_annotations/angles_on_bracket_arrows.py @@ -22,37 +22,39 @@ def get_point_of_rotated_vertical(origin, line_length, degrees): origin[1] + line_length * np.cos(rad)] -fig, ax = plt.subplots(figsize=(8, 7)) -ax.set(xlim=(0, 6), ylim=(-1, 4)) +fig, ax = plt.subplots() +ax.set(xlim=(0, 6), ylim=(-1, 5)) ax.set_title("Orientation of the bracket arrows relative to angleA and angleB") -for i, style in enumerate(["]-[", "|-|"]): - for j, angle in enumerate([-40, 60]): - y = 2*i + j - arrow_centers = ((1, y), (5, y)) - vlines = ((1, y + 0.5), (5, y + 0.5)) - anglesAB = (angle, -angle) - bracketstyle = f"{style}, angleA={anglesAB[0]}, angleB={anglesAB[1]}" - bracket = FancyArrowPatch(*arrow_centers, arrowstyle=bracketstyle, - mutation_scale=42) - ax.add_patch(bracket) - ax.text(3, y + 0.05, bracketstyle, ha="center", va="bottom") - ax.vlines([i[0] for i in vlines], [y, y], [i[1] for i in vlines], - linestyles="--", color="C0") - # Get the top coordinates for the drawn patches at A and B - patch_tops = [get_point_of_rotated_vertical(center, 0.5, angle) - for center, angle in zip(arrow_centers, anglesAB)] - # Define the connection directions for the annotation arrows - connection_dirs = (1, -1) if angle > 0 else (-1, 1) - # Add arrows and annotation text - arrowstyle = "Simple, tail_width=0.5, head_width=4, head_length=8" - for vline, dir, patch_top, angle in zip(vlines, connection_dirs, - patch_tops, anglesAB): - kw = dict(connectionstyle=f"arc3,rad={dir * 0.5}", - arrowstyle=arrowstyle, color="C0") - ax.add_patch(FancyArrowPatch(vline, patch_top, **kw)) - ax.text(vline[0] - dir * 0.15, y + 0.3, f'{angle}°', ha="center", - va="center") +style = ']-[' +for i, angle in enumerate([-40, 0, 60]): + y = 2*i + arrow_centers = ((1, y), (5, y)) + vlines = ((1, y + 0.5), (5, y + 0.5)) + anglesAB = (angle, -angle) + bracketstyle = f"{style}, angleA={anglesAB[0]}, angleB={anglesAB[1]}" + bracket = FancyArrowPatch(*arrow_centers, arrowstyle=bracketstyle, + mutation_scale=42) + ax.add_patch(bracket) + ax.text(3, y + 0.05, bracketstyle, ha="center", va="bottom", fontsize=14) + ax.vlines([line[0] for line in vlines], [y, y], [line[1] for line in vlines], + linestyles="--", color="C0") + # Get the top coordinates for the drawn patches at A and B + patch_tops = [get_point_of_rotated_vertical(center, 0.5, angle) + for center, angle in zip(arrow_centers, anglesAB)] + # Define the connection directions for the annotation arrows + connection_dirs = (1, -1) if angle > 0 else (-1, 1) + # Add arrows and annotation text + arrowstyle = "Simple, tail_width=0.5, head_width=4, head_length=8" + for vline, dir, patch_top, angle in zip(vlines, connection_dirs, + patch_tops, anglesAB): + kw = dict(connectionstyle=f"arc3,rad={dir * 0.5}", + arrowstyle=arrowstyle, color="C0") + ax.add_patch(FancyArrowPatch(vline, patch_top, **kw)) + ax.text(vline[0] - dir * 0.15, y + 0.7, f'{angle}°', ha="center", + va="center") + +plt.show() ############################################################################# # diff --git a/examples/text_labels_and_annotations/arrow_demo.py b/examples/text_labels_and_annotations/arrow_demo.py index cf9e86d12c3b..9607818181dc 100644 --- a/examples/text_labels_and_annotations/arrow_demo.py +++ b/examples/text_labels_and_annotations/arrow_demo.py @@ -148,7 +148,7 @@ def make_arrow_graph(ax, data, size=4, display='length', shape='right', } size = 4 - fig = plt.figure(figsize=(3 * size, size), constrained_layout=True) + fig = plt.figure(figsize=(3 * size, size), layout="constrained") axs = fig.subplot_mosaic([["length", "width", "alpha"]]) for display, ax in axs.items(): diff --git a/examples/text_labels_and_annotations/date.py b/examples/text_labels_and_annotations/date.py index 9c72972a04e4..1bce29c2f5f1 100644 --- a/examples/text_labels_and_annotations/date.py +++ b/examples/text_labels_and_annotations/date.py @@ -32,7 +32,7 @@ # the date column. data = cbook.get_sample_data('goog.npz', np_load=True)['price_data'] -fig, axs = plt.subplots(3, 1, figsize=(6.4, 7), constrained_layout=True) +fig, axs = plt.subplots(3, 1, figsize=(6.4, 7), layout='constrained') # common to all three: for ax in axs: ax.plot('date', 'adj_close', data=data) diff --git a/examples/text_labels_and_annotations/figlegend_demo.py b/examples/text_labels_and_annotations/figlegend_demo.py index c749ae795cd5..e14d242bdd73 100644 --- a/examples/text_labels_and_annotations/figlegend_demo.py +++ b/examples/text_labels_and_annotations/figlegend_demo.py @@ -31,8 +31,8 @@ ############################################################################## # Sometimes we do not want the legend to overlap the axes. If you use -# constrained_layout you can specify "outside right upper", and -# constrained_layout will make room for the legend. +# *constrained layout* you can specify "outside right upper", and +# *constrained layout* will make room for the legend. fig, axs = plt.subplots(1, 2, layout='constrained') diff --git a/examples/text_labels_and_annotations/label_subplots.py b/examples/text_labels_and_annotations/label_subplots.py index 974b775a9a97..b74e9a9d7437 100644 --- a/examples/text_labels_and_annotations/label_subplots.py +++ b/examples/text_labels_and_annotations/label_subplots.py @@ -17,7 +17,7 @@ import matplotlib.transforms as mtransforms fig, axs = plt.subplot_mosaic([['a)', 'c)'], ['b)', 'c)'], ['d)', 'd)']], - constrained_layout=True) + layout='constrained') for label, ax in axs.items(): # label physical distance in and down: @@ -33,7 +33,7 @@ # with each other, in which case we use a slightly different transform: fig, axs = plt.subplot_mosaic([['a)', 'c)'], ['b)', 'c)'], ['d)', 'd)']], - constrained_layout=True) + layout='constrained') for label, ax in axs.items(): # label physical distance to the left and up: @@ -48,7 +48,7 @@ # use the *loc* keyword argument: fig, axs = plt.subplot_mosaic([['a)', 'c)'], ['b)', 'c)'], ['d)', 'd)']], - constrained_layout=True) + layout='constrained') for label, ax in axs.items(): ax.set_title('Normal Title', fontstyle='italic') diff --git a/examples/text_labels_and_annotations/legend_demo.py b/examples/text_labels_and_annotations/legend_demo.py index 11df93095fe4..13b846389280 100644 --- a/examples/text_labels_and_annotations/legend_demo.py +++ b/examples/text_labels_and_annotations/legend_demo.py @@ -63,7 +63,7 @@ ############################################################################### # Here we attach legends to more complex plots. -fig, axs = plt.subplots(3, 1, constrained_layout=True) +fig, axs = plt.subplots(3, 1, layout="constrained") top_ax, middle_ax, bottom_ax = axs top_ax.bar([0, 1, 2], [0.2, 0.3, 0.1], width=0.4, label="Bar 1", @@ -86,7 +86,7 @@ ############################################################################### # Now we'll showcase legend entries with more than one legend key. -fig, (ax1, ax2) = plt.subplots(2, 1, constrained_layout=True) +fig, (ax1, ax2) = plt.subplots(2, 1, layout='constrained') # First plot: two legend keys for a single entry p1 = ax1.scatter([1], [5], c='r', marker='s', s=100) diff --git a/examples/text_labels_and_annotations/titles_demo.py b/examples/text_labels_and_annotations/titles_demo.py index 57323aac38e3..4bf75a87adea 100644 --- a/examples/text_labels_and_annotations/titles_demo.py +++ b/examples/text_labels_and_annotations/titles_demo.py @@ -21,7 +21,7 @@ # The vertical position is automatically chosen to avoid decorations # (i.e. labels and ticks) on the topmost x-axis: -fig, axs = plt.subplots(1, 2, constrained_layout=True) +fig, axs = plt.subplots(1, 2, layout='constrained') ax = axs[0] ax.plot(range(10)) @@ -41,7 +41,7 @@ # Automatic positioning can be turned off by manually specifying the *y* # keyword argument for the title or setting :rc:`axes.titley` in the rcParams. -fig, axs = plt.subplots(1, 2, constrained_layout=True) +fig, axs = plt.subplots(1, 2, layout='constrained') ax = axs[0] ax.plot(range(10)) diff --git a/examples/ticks/date_concise_formatter.py b/examples/ticks/date_concise_formatter.py index 979214b3b406..10b239affac2 100644 --- a/examples/ticks/date_concise_formatter.py +++ b/examples/ticks/date_concise_formatter.py @@ -29,7 +29,7 @@ np.random.seed(19680801) y = np.cumsum(np.random.randn(N)) -fig, axs = plt.subplots(3, 1, constrained_layout=True, figsize=(6, 6)) +fig, axs = plt.subplots(3, 1, layout='constrained', figsize=(6, 6)) lims = [(np.datetime64('2005-02'), np.datetime64('2005-04')), (np.datetime64('2005-02-03'), np.datetime64('2005-02-15')), (np.datetime64('2005-02-03 11:00'), np.datetime64('2005-02-04 13:20'))] @@ -49,7 +49,7 @@ # for this example the labels do not need to be rotated as they do for the # default formatter because the labels are as small as possible. -fig, axs = plt.subplots(3, 1, constrained_layout=True, figsize=(6, 6)) +fig, axs = plt.subplots(3, 1, layout='constrained', figsize=(6, 6)) for nn, ax in enumerate(axs): locator = mdates.AutoDateLocator(minticks=3, maxticks=7) formatter = mdates.ConciseDateFormatter(locator) @@ -73,7 +73,7 @@ munits.registry[datetime.date] = converter munits.registry[datetime.datetime] = converter -fig, axs = plt.subplots(3, 1, figsize=(6, 6), constrained_layout=True) +fig, axs = plt.subplots(3, 1, figsize=(6, 6), layout='constrained') for nn, ax in enumerate(axs): ax.plot(dates, y) ax.set_xlim(lims[nn]) @@ -106,7 +106,7 @@ # Here we modify the labels to be "day month year", instead of the ISO # "year month day": -fig, axs = plt.subplots(3, 1, constrained_layout=True, figsize=(6, 6)) +fig, axs = plt.subplots(3, 1, layout='constrained', figsize=(6, 6)) for nn, ax in enumerate(axs): locator = mdates.AutoDateLocator() @@ -172,7 +172,7 @@ munits.registry[datetime.date] = converter munits.registry[datetime.datetime] = converter -fig, axs = plt.subplots(3, 1, constrained_layout=True, figsize=(6, 6)) +fig, axs = plt.subplots(3, 1, layout='constrained', figsize=(6, 6)) for nn, ax in enumerate(axs): ax.plot(dates, y) ax.set_xlim(lims[nn]) diff --git a/examples/ticks/date_index_formatter.py b/examples/ticks/date_index_formatter.py index a2bf4b8796f9..fb01448fb151 100644 --- a/examples/ticks/date_index_formatter.py +++ b/examples/ticks/date_index_formatter.py @@ -25,12 +25,11 @@ # low, close, volume, adj_close from the mpl-data/sample_data directory. The # record array stores the date as an np.datetime64 with a day unit ('D') in # the date column (``r.date``). -r = (cbook.get_sample_data('goog.npz', np_load=True)['price_data'] - .view(np.recarray)) +r = cbook.get_sample_data('goog.npz', np_load=True)['price_data'].view(np.recarray) r = r[:9] # get the first 9 days -fig, (ax1, ax2) = plt.subplots(nrows=2, figsize=(6, 6), - constrained_layout={'hspace': .15}) +fig, (ax1, ax2) = plt.subplots(nrows=2, figsize=(6, 6), layout='constrained') +fig.get_layout_engine().set(hspace=0.15) # First we'll do it the default way, with gaps on weekends ax1.plot(r.date, r.adj_close, 'o-') diff --git a/examples/ticks/date_precision_and_epochs.py b/examples/ticks/date_precision_and_epochs.py index c50bbd234331..0f4f993f6f04 100644 --- a/examples/ticks/date_precision_and_epochs.py +++ b/examples/ticks/date_precision_and_epochs.py @@ -128,7 +128,7 @@ def _reset_epoch_for_tutorial(): _reset_epoch_for_tutorial() # Don't do this. Just for this tutorial. mdates.set_epoch(new_epoch) -fig, ax = plt.subplots(constrained_layout=True) +fig, ax = plt.subplots(layout='constrained') ax.plot(xold, y) ax.set_title('Epoch: ' + mdates.get_epoch()) ax.xaxis.set_tick_params(rotation=40) @@ -137,7 +137,7 @@ def _reset_epoch_for_tutorial(): ############################################################################# # For dates plotted using the more recent epoch, the plot is smooth: -fig, ax = plt.subplots(constrained_layout=True) +fig, ax = plt.subplots(layout='constrained') ax.plot(x, y) ax.set_title('Epoch: ' + mdates.get_epoch()) ax.xaxis.set_tick_params(rotation=40) diff --git a/examples/ticks/ticks_too_many.py b/examples/ticks/ticks_too_many.py index c1f05bf4c17e..29bde86a4582 100644 --- a/examples/ticks/ticks_too_many.py +++ b/examples/ticks/ticks_too_many.py @@ -21,7 +21,7 @@ import matplotlib.pyplot as plt import numpy as np -fig, ax = plt.subplots(1, 2, constrained_layout=True, figsize=(6, 2.5)) +fig, ax = plt.subplots(1, 2, layout='constrained', figsize=(6, 2.5)) x = ['1', '5', '2', '3'] y = [1, 4, 2, 3] ax[0].plot(x, y, 'd') @@ -60,7 +60,7 @@ # converted from strings to datetime objects to get the proper date locators # and formatters. -fig, ax = plt.subplots(1, 2, constrained_layout=True, figsize=(6, 2.75)) +fig, ax = plt.subplots(1, 2, layout='constrained', figsize=(6, 2.75)) x = ['2021-10-01', '2021-11-02', '2021-12-03', '2021-09-01'] y = [0, 2, 3, 1] ax[0].plot(x, y, 'd') diff --git a/examples/units/units_sample.py b/examples/units/units_sample.py index 81547601e711..13448a30883e 100644 --- a/examples/units/units_sample.py +++ b/examples/units/units_sample.py @@ -19,7 +19,7 @@ cms = cm * np.arange(0, 10, 2) -fig, axs = plt.subplots(2, 2, constrained_layout=True) +fig, axs = plt.subplots(2, 2, layout='constrained') axs[0, 0].plot(cms, cms) diff --git a/examples/user_interfaces/gtk4_spreadsheet_sgskip.py b/examples/user_interfaces/gtk4_spreadsheet_sgskip.py index 509789f5aedb..c3f053480a71 100644 --- a/examples/user_interfaces/gtk4_spreadsheet_sgskip.py +++ b/examples/user_interfaces/gtk4_spreadsheet_sgskip.py @@ -49,7 +49,7 @@ def __init__(self, *args, **kwargs): sw.set_child(self.treeview) # Matplotlib stuff - fig = Figure(figsize=(6, 4), constrained_layout=True) + fig = Figure(figsize=(6, 4), layout='constrained') self.canvas = FigureCanvas(fig) # a Gtk.DrawingArea self.canvas.set_hexpand(True) diff --git a/examples/userdemo/connectionstyle_demo.py b/examples/userdemo/connectionstyle_demo.py index f9def1d94f24..45e1e605e3e4 100644 --- a/examples/userdemo/connectionstyle_demo.py +++ b/examples/userdemo/connectionstyle_demo.py @@ -30,7 +30,7 @@ def demo_con_style(ax, connectionstyle): transform=ax.transAxes, ha="left", va="top") -fig, axs = plt.subplots(3, 5, figsize=(7, 6.3), constrained_layout=True) +fig, axs = plt.subplots(3, 5, figsize=(7, 6.3), layout="constrained") demo_con_style(axs[0, 0], "angle3,angleA=90,angleB=0") demo_con_style(axs[1, 0], "angle3,angleA=0,angleB=90") demo_con_style(axs[0, 1], "arc3,rad=0.") diff --git a/examples/widgets/rectangle_selector.py b/examples/widgets/rectangle_selector.py index 8ede9ad66fc4..f43f9e56fca3 100644 --- a/examples/widgets/rectangle_selector.py +++ b/examples/widgets/rectangle_selector.py @@ -40,7 +40,7 @@ def toggle_selector(event): selector.set_active(True) -fig = plt.figure(constrained_layout=True) +fig = plt.figure(layout='constrained') axs = fig.subplots(2) N = 100000 # If N is large one can see improvement by using blitting. diff --git a/lib/matplotlib/animation.py b/lib/matplotlib/animation.py index 864e180f42bf..2d8156a51599 100644 --- a/lib/matplotlib/animation.py +++ b/lib/matplotlib/animation.py @@ -193,6 +193,8 @@ def setup(self, fig, outfile, dpi=None): The DPI (or resolution) for the file. This controls the size in pixels of the resulting movie file. """ + # Check that path is valid + Path(outfile).parent.resolve(strict=True) self.outfile = outfile self.fig = fig if dpi is None: @@ -405,6 +407,8 @@ def setup(self, fig, outfile, dpi=None, frame_prefix=None): deleted by `finish`; if not *None*, no temporary files are deleted. """ + # Check that path is valid + Path(outfile).parent.resolve(strict=True) self.fig = fig self.outfile = outfile if dpi is None: @@ -423,7 +427,7 @@ def setup(self, fig, outfile, dpi=None, frame_prefix=None): self.fname_format_str = '%s%%07d.%s' def __del__(self): - if self._tmpdir: + if hasattr(self, '_tmpdir') and self._tmpdir: self._tmpdir.cleanup() @property @@ -988,6 +992,15 @@ def func(current_frame: int, total_frames: int) -> Any is a `.MovieWriter`, a `RuntimeError` will be raised. """ + all_anim = [self] + if extra_anim is not None: + all_anim.extend(anim for anim in extra_anim + if anim._fig is self._fig) + + # Disable "Animation was deleted without rendering" warning. + for anim in all_anim: + anim._draw_was_started = True + if writer is None: writer = mpl.rcParams['animation.writer'] elif (not isinstance(writer, str) and @@ -1026,11 +1039,6 @@ def func(current_frame: int, total_frames: int) -> Any if metadata is not None: writer_kwargs['metadata'] = metadata - all_anim = [self] - if extra_anim is not None: - all_anim.extend(anim for anim in extra_anim - if anim._fig is self._fig) - # If we have the name of a writer, instantiate an instance of the # registered class. if isinstance(writer, str): diff --git a/lib/matplotlib/axes/_axes.py b/lib/matplotlib/axes/_axes.py index 9129e83ac008..5593b58b9b6c 100644 --- a/lib/matplotlib/axes/_axes.py +++ b/lib/matplotlib/axes/_axes.py @@ -6113,7 +6113,7 @@ def pcolormesh(self, *args, alpha=None, norm=None, cmap=None, vmin=None, shading : {'flat', 'nearest', 'gouraud', 'auto'}, optional The fill style for the quadrilateral; defaults to - 'flat' or :rc:`pcolor.shading`. Possible values: + :rc:`pcolor.shading`. Possible values: - 'flat': A solid color is used for each quad. The color of the quad (i, j), (i+1, j), (i, j+1), (i+1, j+1) is given by diff --git a/lib/matplotlib/axes/_base.py b/lib/matplotlib/axes/_base.py index d10b4e020056..fe1fac98eeeb 100644 --- a/lib/matplotlib/axes/_base.py +++ b/lib/matplotlib/axes/_base.py @@ -2545,9 +2545,7 @@ def _process_unit_info(self, datasets=None, kwargs=None, *, convert=True): except KeyError: raise ValueError(f"Invalid axis name: {axis_name!r}") from None # Update from data if axis is already set but no unit is set yet. - if (axis is not None and - data is not None and - not axis._have_units_and_converter()): + if axis is not None and data is not None and not axis.have_units(): axis.update_units(data) for axis_name, axis in axis_map.items(): # Return if no axis is set. diff --git a/lib/matplotlib/axis.py b/lib/matplotlib/axis.py index 0b4646cd5df7..3724cc811e08 100644 --- a/lib/matplotlib/axis.py +++ b/lib/matplotlib/axis.py @@ -866,6 +866,11 @@ def clear(self): - registered callbacks """ self.label._reset_visual_defaults() + # The above resets the label formatting using text rcParams, + # so we then update the formatting using axes rcParams + self.label.set_color(mpl.rcParams['axes.labelcolor']) + self.label.set_fontsize(mpl.rcParams['axes.labelsize']) + self.label.set_fontweight(mpl.rcParams['axes.labelweight']) self.offsetText._reset_visual_defaults() self.labelpad = mpl.rcParams['axes.labelpad'] @@ -1711,17 +1716,8 @@ def _update_axisinfo(self): self.set_default_intervals() def have_units(self): - """ - Return `True` if units or a converter have been set. - """ return self.converter is not None or self.units is not None - def _have_units_and_converter(self): - """ - Return `True` if units and a converter have been set. - """ - return self.converter is not None and self.units is not None - def convert_units(self, x): # If x is natively supported by Matplotlib, doesn't need converting if munits._is_natively_supported(x): diff --git a/lib/matplotlib/backend_bases.py b/lib/matplotlib/backend_bases.py index 6ce8ce61a119..6532355f7efe 100644 --- a/lib/matplotlib/backend_bases.py +++ b/lib/matplotlib/backend_bases.py @@ -311,9 +311,11 @@ def draw_gouraud_triangles(self, gc, triangles_array, colors_array, Parameters ---------- - points : (N, 3, 2) array-like + gc : `.GraphicsContextBase` + The graphics context. + triangles_array : (N, 3, 2) array-like Array of *N* (x, y) points for the triangles. - colors : (N, 3, 4) array-like + colors_array : (N, 3, 4) array-like Array of *N* RGBA colors for each point of the triangles. transform : `matplotlib.transforms.Transform` An affine transform to apply to the points. @@ -609,6 +611,8 @@ def _draw_text_as_path(self, gc, x, y, s, prop, angle, ismath): Parameters ---------- + gc : `.GraphicsContextBase` + The graphics context. x : float The x location of the text in display coords. y : float diff --git a/lib/matplotlib/backend_managers.py b/lib/matplotlib/backend_managers.py index 5366e8e611f4..ac74ff97a4e8 100644 --- a/lib/matplotlib/backend_managers.py +++ b/lib/matplotlib/backend_managers.py @@ -238,10 +238,8 @@ def add_tool(self, name, tool, *args, **kwargs): tool : type Class of the tool to be added. A subclass will be used instead if one was registered for the current canvas class. - - Notes - ----- - args and kwargs get passed directly to the tools constructor. + *args, **kwargs + Passed to the *tool*'s constructor. See Also -------- diff --git a/lib/matplotlib/backends/_backend_tk.py b/lib/matplotlib/backends/_backend_tk.py index f26619c55ec1..4e5c00251a54 100644 --- a/lib/matplotlib/backends/_backend_tk.py +++ b/lib/matplotlib/backends/_backend_tk.py @@ -675,8 +675,8 @@ def _rescale(self): # Text-only button is handled by the font setting instead. pass elif isinstance(widget, tk.Frame): - widget.configure(height='22p', pady='1p') - widget.pack_configure(padx='4p') + widget.configure(height='18p') + widget.pack_configure(padx='3p') elif isinstance(widget, tk.Label): pass # Text is handled by the font setting instead. else: diff --git a/lib/matplotlib/backends/backend_gtk4.py b/lib/matplotlib/backends/backend_gtk4.py index 8628e14de096..328819292018 100644 --- a/lib/matplotlib/backends/backend_gtk4.py +++ b/lib/matplotlib/backends/backend_gtk4.py @@ -74,7 +74,11 @@ def __init__(self, figure=None): self.set_focusable(True) css = Gtk.CssProvider() - css.load_from_data(b".matplotlib-canvas { background-color: white; }") + style = '.matplotlib-canvas { background-color: white; }' + if Gtk.check_version(4, 9, 3) is None: + css.load_from_data(style, -1) + else: + css.load_from_data(style.encode('utf-8')) style_ctx = self.get_style_context() style_ctx.add_provider(css, Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION) style_ctx.add_class("matplotlib-canvas") diff --git a/lib/matplotlib/backends/backend_qt.py b/lib/matplotlib/backends/backend_qt.py index eb08c734af20..fc6639914d35 100644 --- a/lib/matplotlib/backends/backend_qt.py +++ b/lib/matplotlib/backends/backend_qt.py @@ -898,7 +898,7 @@ def _tight_layout(self): self._figure.tight_layout() for attr, spinbox in self._spinboxes.items(): spinbox.blockSignals(True) - spinbox.setValue(vars(self._figure.subplotpars)[attr]) + spinbox.setValue(getattr(self._figure.subplotpars, attr)) spinbox.blockSignals(False) self._figure.canvas.draw_idle() diff --git a/lib/matplotlib/colorbar.py b/lib/matplotlib/colorbar.py index 966eb0760b47..14c7c1e58b9a 100644 --- a/lib/matplotlib/colorbar.py +++ b/lib/matplotlib/colorbar.py @@ -1003,7 +1003,7 @@ def _set_scale(self, scale, **kwargs): Parameters ---------- - value : {"linear", "log", "symlog", "logit", ...} or `.ScaleBase` + scale : {"linear", "log", "symlog", "logit", ...} or `.ScaleBase` The axis scale type to apply. **kwargs diff --git a/lib/matplotlib/colors.py b/lib/matplotlib/colors.py index 9c0725c8888a..a74650d5a1f3 100644 --- a/lib/matplotlib/colors.py +++ b/lib/matplotlib/colors.py @@ -1321,7 +1321,7 @@ def __call__(self, value, clip=None): ---------- value Data to normalize. - clip : bool + clip : bool, optional If ``None``, defaults to ``self.clip`` (which defaults to ``False``). @@ -1456,7 +1456,7 @@ def autoscale_None(self, A): def __call__(self, value, clip=None): """ - Map value to the interval [0, 1]. The clip argument is unused. + Map value to the interval [0, 1]. The *clip* argument is unused. """ result, is_scalar = self.process_value(value) self.autoscale_None(result) # sets self.vmin, self.vmax if None @@ -1505,6 +1505,10 @@ def __init__(self, vcenter=0, halfrange=None, clip=False): *vcenter* + *halfrange* is ``1.0`` in the normalization. Defaults to the largest absolute difference to *vcenter* for the values in the dataset. + clip : bool, default: False + If ``True`` values falling outside the range ``[vmin, vmax]``, + are mapped to 0 or 1, whichever is closer, and masked values are + set to 1. If ``False`` masked values remain masked. Examples -------- @@ -2405,7 +2409,8 @@ def shade(self, data, cmap, norm=None, blend_mode='overlay', vmin=None, full illumination or shadow (and clipping any values that move beyond 0 or 1). Note that this is not visually or mathematically the same as vertical exaggeration. - Additional kwargs are passed on to the *blend_mode* function. + **kwargs + Additional kwargs are passed on to the *blend_mode* function. Returns ------- @@ -2466,7 +2471,8 @@ def shade_rgb(self, rgb, elevation, fraction=1., blend_mode='hsv', The x-spacing (columns) of the input *elevation* grid. dy : number, optional The y-spacing (rows) of the input *elevation* grid. - Additional kwargs are passed on to the *blend_mode* function. + **kwargs + Additional kwargs are passed on to the *blend_mode* function. Returns ------- diff --git a/lib/matplotlib/figure.py b/lib/matplotlib/figure.py index 27b16b17a86b..c6df929e04ee 100644 --- a/lib/matplotlib/figure.py +++ b/lib/matplotlib/figure.py @@ -13,8 +13,22 @@ `SubplotParams` Control the default spacing between subplots. -See :ref:`figure_explanation` for narrative on how figures are used in -Matplotlib. +Figures are typically created using pyplot methods `~.pyplot.figure`, +`~.pyplot.subplots`, and `~.pyplot.subplot_mosaic`. + +.. plot:: + :include-source: + + fig, ax = plt.subplots(figsize=(2, 2), facecolor='lightskyblue', + layout='constrained') + fig.suptitle('Figure') + ax.set_title('Axes', loc='left', fontstyle='oblique', fontsize='medium') + +Some situations call for directly instantiating a `~.figure.Figure` class, +usually inside an application of some sort (see :ref:`user_interfaces` for a +list of examples) . More information about Figures can be found at +:ref:`figure_explanation`. + """ from contextlib import ExitStack @@ -936,7 +950,7 @@ def clear(self, keep_observers=False): Parameters ---------- - keep_observers: bool, default: False + keep_observers : bool, default: False Set *keep_observers* to True if, for example, a gui widget is tracking the Axes in the figure. """ @@ -976,7 +990,7 @@ def clf(self, keep_observers=False): Parameters ---------- - keep_observers: bool, default: False + keep_observers : bool, default: False Set *keep_observers* to True if, for example, a gui widget is tracking the Axes in the figure. """ @@ -1089,7 +1103,6 @@ def legend(self, *args, **kwargs): ---------------- %(_legend_kw_figure)s - See Also -------- .Axes.legend @@ -2415,15 +2428,15 @@ def __init__(self, The use of this parameter is discouraged. Please use ``layout='constrained'`` instead. - layout : {'constrained', 'compressed', 'tight', `.LayoutEngine`, None} + layout : {'constrained', 'compressed', 'tight', 'none', `.LayoutEngine`, \ +None}, default: None The layout mechanism for positioning of plot elements to avoid overlapping Axes decorations (labels, ticks, etc). Note that layout managers can have significant performance penalties. - Defaults to *None*. - 'constrained': The constrained layout solver adjusts axes sizes - to avoid overlapping axes decorations. Can handle complex plot - layouts and colorbars, and is thus recommended. + to avoid overlapping axes decorations. Can handle complex plot + layouts and colorbars, and is thus recommended. See :doc:`/tutorials/intermediate/constrainedlayout_guide` for examples. @@ -2437,6 +2450,8 @@ def __init__(self, decorations do not overlap. See `.Figure.set_tight_layout` for further details. + - 'none': Do not use a layout engine. + - A `.LayoutEngine` instance. Builtin layout classes are `.ConstrainedLayoutEngine` and `.TightLayoutEngine`, more easily accessible by 'constrained' and 'tight'. Passing an instance diff --git a/lib/matplotlib/gridspec.py b/lib/matplotlib/gridspec.py index e3abb4425aba..d4eecaf4b5a2 100644 --- a/lib/matplotlib/gridspec.py +++ b/lib/matplotlib/gridspec.py @@ -447,6 +447,10 @@ def tight_layout(self, figure, renderer=None, Parameters ---------- + figure : `.Figure` + The figure. + renderer : `.RendererBase` subclass, optional + The renderer to be used. pad : float Padding between the figure edge and the edges of subplots, as a fraction of the font-size. diff --git a/lib/matplotlib/image.py b/lib/matplotlib/image.py index ba495f8e3f1a..51db3fa5c3d4 100644 --- a/lib/matplotlib/image.py +++ b/lib/matplotlib/image.py @@ -1048,8 +1048,10 @@ def __init__(self, ax, *, interpolation='nearest', **kwargs): """ Parameters ---------- + ax : `~.axes.Axes` + The axes the image will belong to. interpolation : {'nearest', 'bilinear'}, default: 'nearest' - + The interpolation scheme used in the resampling. **kwargs All other keyword arguments are identical to those of `.AxesImage`. """ diff --git a/lib/matplotlib/layout_engine.py b/lib/matplotlib/layout_engine.py index 49b3f1dd125f..248ad13757f8 100644 --- a/lib/matplotlib/layout_engine.py +++ b/lib/matplotlib/layout_engine.py @@ -167,7 +167,10 @@ def execute(self, fig): ---------- fig : `.Figure` to perform layout on. - See also: `.figure.Figure.tight_layout` and `.pyplot.tight_layout`. + See Also + -------- + .figure.Figure.tight_layout + .pyplot.tight_layout """ info = self._params renderer = fig._get_renderer() diff --git a/lib/matplotlib/legend.py b/lib/matplotlib/legend.py index e9e0651066b3..2d41189b898a 100644 --- a/lib/matplotlib/legend.py +++ b/lib/matplotlib/legend.py @@ -158,8 +158,7 @@ def _update_bbox_to_anchor(self, loc_in_canvas): same height, set to ``[0.5]``. markerscale : float, default: :rc:`legend.markerscale` - The relative size of legend markers compared with the originally - drawn ones. + The relative size of legend markers compared to the originally drawn ones. markerfirst : bool, default: True If *True*, legend marker is placed to the left of the legend label. @@ -254,52 +253,55 @@ def _update_bbox_to_anchor(self, loc_in_canvas): """ _loc_doc_base = """ -loc : str or pair of floats, {0} +loc : str or pair of floats, default: {default} The location of the legend. - The strings - ``'upper left', 'upper right', 'lower left', 'lower right'`` - place the legend at the corresponding corner of the axes/figure. + The strings ``'upper left'``, ``'upper right'``, ``'lower left'``, + ``'lower right'`` place the legend at the corresponding corner of the + {parent}. - The strings - ``'upper center', 'lower center', 'center left', 'center right'`` - place the legend at the center of the corresponding edge of the - axes/figure. - - The string ``'center'`` places the legend at the center of the axes/figure. - - The string ``'best'`` places the legend at the location, among the nine - locations defined so far, with the minimum overlap with other drawn - artists. This option can be quite slow for plots with large amounts of - data; your plotting speed may benefit from providing a specific location. + The strings ``'upper center'``, ``'lower center'``, ``'center left'``, + ``'center right'`` place the legend at the center of the corresponding edge + of the {parent}. + The string ``'center'`` places the legend at the center of the {parent}. +{best} The location can also be a 2-tuple giving the coordinates of the lower-left - corner of the legend in axes coordinates (in which case *bbox_to_anchor* + corner of the legend in {parent} coordinates (in which case *bbox_to_anchor* will be ignored). For back-compatibility, ``'center right'`` (but no other location) can also - be spelled ``'right'``, and each "string" locations can also be given as a + be spelled ``'right'``, and each "string" location can also be given as a numeric value: - =============== ============= - Location String Location Code - =============== ============= - 'best' 0 - 'upper right' 1 - 'upper left' 2 - 'lower left' 3 - 'lower right' 4 - 'right' 5 - 'center left' 6 - 'center right' 7 - 'lower center' 8 - 'upper center' 9 - 'center' 10 - =============== ============= - {1}""" - -_legend_kw_axes_st = (_loc_doc_base.format("default: :rc:`legend.loc`", '') + - _legend_kw_doc_base) + ================== ============= + Location String Location Code + ================== ============= + 'best' (Axes only) 0 + 'upper right' 1 + 'upper left' 2 + 'lower left' 3 + 'lower right' 4 + 'right' 5 + 'center left' 6 + 'center right' 7 + 'lower center' 8 + 'upper center' 9 + 'center' 10 + ================== ============= + {outside}""" + +_loc_doc_best = """ + The string ``'best'`` places the legend at the location, among the nine + locations defined so far, with the minimum overlap with other drawn + artists. This option can be quite slow for plots with large amounts of + data; your plotting speed may benefit from providing a specific location. +""" + +_legend_kw_axes_st = ( + _loc_doc_base.format(parent='axes', default=':rc:`legend.loc`', + best=_loc_doc_best, outside='') + + _legend_kw_doc_base) _docstring.interpd.update(_legend_kw_axes=_legend_kw_axes_st) _outside_doc = """ @@ -314,21 +316,23 @@ def _update_bbox_to_anchor(self, loc_in_canvas): :doc:`/tutorials/intermediate/legend_guide` for more details. """ -_legend_kw_figure_st = (_loc_doc_base.format("default: 'upper right'", - _outside_doc) + - _legend_kw_doc_base) +_legend_kw_figure_st = ( + _loc_doc_base.format(parent='figure', default="'upper right'", + best='', outside=_outside_doc) + + _legend_kw_doc_base) _docstring.interpd.update(_legend_kw_figure=_legend_kw_figure_st) _legend_kw_both_st = ( - _loc_doc_base.format("default: 'best' for axes, 'upper right' for figures", - _outside_doc) + + _loc_doc_base.format(parent='axes/figure', + default=":rc:`legend.loc` for Axes, 'upper right' for Figure", + best=_loc_doc_best, outside=_outside_doc) + _legend_kw_doc_base) _docstring.interpd.update(_legend_kw_doc=_legend_kw_both_st) class Legend(Artist): """ - Place a legend on the axes at location loc. + Place a legend on the figure/axes. """ # 'best' is only implemented for axes legends @@ -407,17 +411,6 @@ def __init__( List of `.Artist` objects added as legend entries. .. versionadded:: 3.7 - - Notes - ----- - Users can specify any arbitrary location for the legend using the - *bbox_to_anchor* keyword argument. *bbox_to_anchor* can be a - `.BboxBase` (or derived there from) or a tuple of 2 or 4 floats. - See `set_bbox_to_anchor` for more detail. - - The legend location can be specified by setting *loc* with a tuple of - 2 floats, which is interpreted as the lower-left corner of the legend - in the normalized axes coordinate. """ # local import only to avoid circularity from matplotlib.axes import Axes diff --git a/lib/matplotlib/offsetbox.py b/lib/matplotlib/offsetbox.py index 2c92dea259a3..8ad9806c2ec8 100644 --- a/lib/matplotlib/offsetbox.py +++ b/lib/matplotlib/offsetbox.py @@ -1505,7 +1505,6 @@ def __init__(self, ref_artist, use_blit=False): if not ref_artist.pickable(): ref_artist.set_picker(True) self.got_artist = False - self.canvas = self.ref_artist.figure.canvas self._use_blit = use_blit and self.canvas.supports_blit self.cids = [ self.canvas.callbacks._connect_picklable( @@ -1514,6 +1513,9 @@ def __init__(self, ref_artist, use_blit=False): 'button_release_event', self.on_release), ] + # A property, not an attribute, to maintain picklability. + canvas = property(lambda self: self.ref_artist.figure.canvas) + def on_motion(self, evt): if self._check_still_parented() and self.got_artist: dx = evt.x - self.mouse_x diff --git a/lib/matplotlib/patches.py b/lib/matplotlib/patches.py index de10fd47daf3..2b4e0dc6e6a9 100644 --- a/lib/matplotlib/patches.py +++ b/lib/matplotlib/patches.py @@ -3196,29 +3196,18 @@ def __init__(self, head_length=.4, head_width=.2, widthA=1., widthB=1., Parameters ---------- head_length : float, default: 0.4 - Length of the arrow head, relative to *mutation_scale*. + Length of the arrow head, relative to *mutation_size*. head_width : float, default: 0.2 - Width of the arrow head, relative to *mutation_scale*. - widthA : float, default: 1.0 - Width of the bracket at the beginning of the arrow - widthB : float, default: 1.0 - Width of the bracket at the end of the arrow - lengthA : float, default: 0.2 - Length of the bracket at the beginning of the arrow - lengthB : float, default: 0.2 - Length of the bracket at the end of the arrow - angleA : float, default 0 - Orientation of the bracket at the beginning, as a - counterclockwise angle. 0 degrees means perpendicular - to the line. - angleB : float, default 0 - Orientation of the bracket at the beginning, as a - counterclockwise angle. 0 degrees means perpendicular - to the line. - scaleA : float, default *mutation_size* - The mutation_size for the beginning bracket - scaleB : float, default *mutation_size* - The mutation_size for the end bracket + Width of the arrow head, relative to *mutation_size*. + widthA, widthB : float, default: 1.0 + Width of the bracket. + lengthA, lengthB : float, default: 0.2 + Length of the bracket. + angleA, angleB : float, default: 0 + Orientation of the bracket, as a counterclockwise angle. + 0 degrees means perpendicular to the line. + scaleA, scaleB : float, default: *mutation_size* + The scale of the brackets. """ self.head_length, self.head_width = head_length, head_width diff --git a/lib/matplotlib/pyplot.py b/lib/matplotlib/pyplot.py index 04b9bdb79ab2..9a4cb27e30dc 100644 --- a/lib/matplotlib/pyplot.py +++ b/lib/matplotlib/pyplot.py @@ -325,11 +325,12 @@ def draw_if_interactive(): # show is already present, as the latter may be here for backcompat. manager_class = getattr(getattr(backend_mod, "FigureCanvas", None), "manager_class", None) - # We can't compare directly manager_class.pyplot_show and FMB.pyplot_show - # because pyplot_show is a classmethod so the above constructs are bound - # classmethods, & thus always different (being bound to different classes). - manager_pyplot_show = vars(manager_class).get("pyplot_show") - base_pyplot_show = vars(FigureManagerBase).get("pyplot_show") + # We can't compare directly manager_class.pyplot_show and FMB.pyplot_show because + # pyplot_show is a classmethod so the above constructs are bound classmethods, and + # thus always different (being bound to different classes). We also have to use + # getattr_static instead of vars as manager_class could have no __dict__. + manager_pyplot_show = inspect.getattr_static(manager_class, "pyplot_show", None) + base_pyplot_show = inspect.getattr_static(FigureManagerBase, "pyplot_show", None) if (show is None or (manager_pyplot_show is not None and manager_pyplot_show != base_pyplot_show)): @@ -740,12 +741,38 @@ def figure(num=None, # autoincrement if None, else integer from 1-N clear : bool, default: False If True and the figure already exists, then it is cleared. - layout : {'constrained', 'tight', `.LayoutEngine`, None}, default: None + layout : {'constrained', 'compressed', 'tight', 'none', `.LayoutEngine`, None}, \ +default: None The layout mechanism for positioning of plot elements to avoid overlapping Axes decorations (labels, ticks, etc). Note that layout - managers can measurably slow down figure display. Defaults to *None* - (but see the documentation of the `.Figure` constructor regarding the - interaction with rcParams). + managers can measurably slow down figure display. + + - 'constrained': The constrained layout solver adjusts axes sizes + to avoid overlapping axes decorations. Can handle complex plot + layouts and colorbars, and is thus recommended. + + See :doc:`/tutorials/intermediate/constrainedlayout_guide` + for examples. + + - 'compressed': uses the same algorithm as 'constrained', but + removes extra space between fixed-aspect-ratio Axes. Best for + simple grids of axes. + + - 'tight': Use the tight layout mechanism. This is a relatively + simple algorithm that adjusts the subplot parameters so that + decorations do not overlap. See `.Figure.set_tight_layout` for + further details. + + - 'none': Do not use a layout engine. + + - A `.LayoutEngine` instance. Builtin layout classes are + `.ConstrainedLayoutEngine` and `.TightLayoutEngine`, more easily + accessible by 'constrained' and 'tight'. Passing an instance + allows third parties to provide their own layout engine. + + If not given, fall back to using the parameters *tight_layout* and + *constrained_layout*, including their config defaults + :rc:`figure.autolayout` and :rc:`figure.constrained_layout.use`. **kwargs Additional keyword arguments are passed to the `.Figure` constructor. diff --git a/lib/matplotlib/style/core.py b/lib/matplotlib/style/core.py index 6a97d3e3ec77..4ff4618ca6a3 100644 --- a/lib/matplotlib/style/core.py +++ b/lib/matplotlib/style/core.py @@ -153,7 +153,7 @@ def use(style): path = (importlib_resources.files(pkg) / f"{name}.{STYLE_EXTENSION}") style = _rc_params_in_file(path) - except (ModuleNotFoundError, IOError) as exc: + except (ModuleNotFoundError, OSError, TypeError) as exc: # There is an ambiguity whether a dotted name refers to a # package.style_name or to a dotted file path. Currently, # we silently try the first form and then the second one; diff --git a/lib/matplotlib/testing/jpl_units/UnitDbl.py b/lib/matplotlib/testing/jpl_units/UnitDbl.py index d7abc42ad46e..b713ab3aba67 100644 --- a/lib/matplotlib/testing/jpl_units/UnitDbl.py +++ b/lib/matplotlib/testing/jpl_units/UnitDbl.py @@ -91,8 +91,6 @@ def __bool__(self): def _cmp(self, op, rhs): """Check that *self* and *rhs* share units; compare them using *op*.""" - if rhs is None: - return NotImplemented self.checkSameUnits(rhs, "compare") return op(self._value, rhs._value) diff --git a/lib/matplotlib/tests/baseline_images/test_patches/units_rectangle.png b/lib/matplotlib/tests/baseline_images/test_patches/units_rectangle.png index f60e962f342c..651e1e2ef95a 100644 Binary files a/lib/matplotlib/tests/baseline_images/test_patches/units_rectangle.png and b/lib/matplotlib/tests/baseline_images/test_patches/units_rectangle.png differ diff --git a/lib/matplotlib/tests/test_animation.py b/lib/matplotlib/tests/test_animation.py index 2124493d3132..49e6a374ea57 100644 --- a/lib/matplotlib/tests/test_animation.py +++ b/lib/matplotlib/tests/test_animation.py @@ -506,3 +506,13 @@ def test_disable_cache_warning(anim): ) assert anim._cache_frame_data is False anim._init_draw() + + +def test_movie_writer_invalid_path(anim): + if sys.platform == "win32": + match_str = re.escape("[WinError 3] The system cannot find the path specified:") + else: + match_str = re.escape("[Errno 2] No such file or directory: '/foo") + with pytest.raises(FileNotFoundError, match=match_str): + anim.save("/foo/bar/aardvark/thiscannotreallyexist.mp4", + writer=animation.FFMpegFileWriter()) diff --git a/lib/matplotlib/tests/test_axes.py b/lib/matplotlib/tests/test_axes.py index 8bf6051b3e8a..004f6320de1f 100644 --- a/lib/matplotlib/tests/test_axes.py +++ b/lib/matplotlib/tests/test_axes.py @@ -8431,3 +8431,15 @@ def test_zorder_and_explicit_rasterization(): ln, = ax.plot(range(5), rasterized=True, zorder=1) with io.BytesIO() as b: fig.savefig(b, format='pdf') + + +@mpl.style.context('default') +def test_rc_axes_label_formatting(): + mpl.rcParams['axes.labelcolor'] = 'red' + mpl.rcParams['axes.labelsize'] = 20 + mpl.rcParams['axes.labelweight'] = 'bold' + + ax = plt.axes() + assert ax.xaxis.label.get_color() == 'red' + assert ax.xaxis.label.get_fontsize() == 20 + assert ax.xaxis.label.get_fontweight() == 'bold' diff --git a/lib/matplotlib/tests/test_backends_interactive.py b/lib/matplotlib/tests/test_backends_interactive.py index c3b7ed206d18..24d47bb1cf75 100644 --- a/lib/matplotlib/tests/test_backends_interactive.py +++ b/lib/matplotlib/tests/test_backends_interactive.py @@ -72,7 +72,7 @@ def _get_testable_interactive_backends(): return envs -_test_timeout = 60 # A reasonably safe value for slower architectures. +_test_timeout = 120 # A reasonably safe value for slower architectures. def _test_toolbar_button_la_mode_icon(fig): diff --git a/lib/matplotlib/tests/test_dates.py b/lib/matplotlib/tests/test_dates.py index 7abebcde7e56..cc9a83a5c5b6 100644 --- a/lib/matplotlib/tests/test_dates.py +++ b/lib/matplotlib/tests/test_dates.py @@ -636,6 +636,27 @@ def test_concise_formatter_show_offset(t_delta, expected): assert formatter.get_offset() == expected +def test_concise_converter_stays(): + # This test demonstrates problems introduced by gh-23417 (reverted in gh-25278) + # In particular, downstream libraries like Pandas had their designated converters + # overridden by actions like setting xlim (or plotting additional points using + # stdlib/numpy dates and string date representation, which otherwise work fine with + # their date converters) + # While this is a bit of a toy example that would be unusual to see it demonstrates + # the same ideas (namely having a valid converter already applied that is desired) + # without introducing additional subclasses. + # See also discussion at gh-25219 for how Pandas was affected + x = [datetime.datetime(2000, 1, 1), datetime.datetime(2020, 2, 20)] + y = [0, 1] + fig, ax = plt.subplots() + ax.plot(x, y) + # Bypass Switchable date converter + ax.xaxis.converter = conv = mdates.ConciseDateConverter() + assert ax.xaxis.units is None + ax.set_xlim(*x) + assert ax.xaxis.converter == conv + + def test_offset_changes(): fig, ax = plt.subplots() diff --git a/lib/matplotlib/tests/test_lines.py b/lib/matplotlib/tests/test_lines.py index 7eecf5675a4b..b75d3c01b28e 100644 --- a/lib/matplotlib/tests/test_lines.py +++ b/lib/matplotlib/tests/test_lines.py @@ -185,7 +185,7 @@ def test_set_drawstyle(): @image_comparison( ['line_collection_dashes'], remove_text=True, style='mpl20', - tol=0.62 if platform.machine() in ('aarch64', 'ppc64le', 's390x') else 0) + tol=0.65 if platform.machine() in ('aarch64', 'ppc64le', 's390x') else 0) def test_set_line_coll_dash_image(): fig, ax = plt.subplots() np.random.seed(0) diff --git a/lib/matplotlib/tests/test_pickle.py b/lib/matplotlib/tests/test_pickle.py index ec6bdcc2fe14..a31927d59634 100644 --- a/lib/matplotlib/tests/test_pickle.py +++ b/lib/matplotlib/tests/test_pickle.py @@ -1,6 +1,7 @@ from io import BytesIO import ast import pickle +import pickletools import numpy as np import pytest @@ -88,6 +89,7 @@ def _generate_complete_test_figure(fig_ref): plt.subplot(3, 3, 9) plt.errorbar(x, x * -0.5, xerr=0.2, yerr=0.4) + plt.legend(draggable=True) @mpl.style.context("default") @@ -95,9 +97,13 @@ def _generate_complete_test_figure(fig_ref): def test_complete(fig_test, fig_ref): _generate_complete_test_figure(fig_ref) # plotting is done, now test its pickle-ability - pkl = BytesIO() - pickle.dump(fig_ref, pkl, pickle.HIGHEST_PROTOCOL) - loaded = pickle.loads(pkl.getbuffer()) + pkl = pickle.dumps(fig_ref, pickle.HIGHEST_PROTOCOL) + # FigureCanvasAgg is picklable and GUI canvases are generally not, but there should + # be no reference to the canvas in the pickle stream in either case. In order to + # keep the test independent of GUI toolkits, run it with Agg and check that there's + # no reference to FigureCanvasAgg in the pickle stream. + assert "FigureCanvasAgg" not in [arg for op, arg, pos in pickletools.genops(pkl)] + loaded = pickle.loads(pkl) loaded.canvas.draw() fig_test.set_size_inches(loaded.get_size_inches()) diff --git a/lib/matplotlib/tests/test_style.py b/lib/matplotlib/tests/test_style.py index 7d1ed94ea236..07233ef9d01f 100644 --- a/lib/matplotlib/tests/test_style.py +++ b/lib/matplotlib/tests/test_style.py @@ -205,3 +205,5 @@ def test_style_from_module(tmp_path, monkeypatch): assert mpl.rcParams["lines.linewidth"] == 42 mpl.style.use("mpl_test_style_pkg.mplstyle") assert mpl.rcParams["lines.linewidth"] == 84 + mpl.style.use("./mpl_test_style_pkg.mplstyle") + assert mpl.rcParams["lines.linewidth"] == 84 diff --git a/lib/matplotlib/tests/test_text.py b/lib/matplotlib/tests/test_text.py index f775efa01de4..5c431b4e8303 100644 --- a/lib/matplotlib/tests/test_text.py +++ b/lib/matplotlib/tests/test_text.py @@ -701,6 +701,22 @@ def test_wrap(): 'times.') +def test_get_window_extent_wrapped(): + # Test that a long title that wraps to two lines has the same vertical + # extent as an explicit two line title. + + fig1 = plt.figure(figsize=(3, 3)) + fig1.suptitle("suptitle that is clearly too long in this case", wrap=True) + window_extent_test = fig1._suptitle.get_window_extent() + + fig2 = plt.figure(figsize=(3, 3)) + fig2.suptitle("suptitle that is clearly\ntoo long in this case") + window_extent_ref = fig2._suptitle.get_window_extent() + + assert window_extent_test.y0 == window_extent_ref.y0 + assert window_extent_test.y1 == window_extent_ref.y1 + + def test_long_word_wrap(): fig = plt.figure(figsize=(6, 4)) text = fig.text(9.5, 8, 'Alonglineoftexttowrap', wrap=True) diff --git a/lib/matplotlib/tests/test_units.py b/lib/matplotlib/tests/test_units.py index 85a63ecc2f10..d3b8c5a71643 100644 --- a/lib/matplotlib/tests/test_units.py +++ b/lib/matplotlib/tests/test_units.py @@ -283,19 +283,3 @@ def test_plot_kernel(): # just a smoketest that fail kernel = Kernel([1, 2, 3, 4, 5]) plt.plot(kernel) - - -@pytest.mark.parametrize('plot_meth_name', ['scatter', 'plot']) -def test_unit_axis_label(plot_meth_name): - # Check that the correct Axis labels are set on plots with units - import matplotlib.testing.jpl_units as units - units.register() - - fig, ax = plt.subplots() - ax.xaxis.set_units('m') - ax.yaxis.set_units('sec') - plot_method = getattr(ax, plot_meth_name) - plot_method(np.arange(3) * units.m, np.arange(3) * units.sec) - assert ax.get_xlabel() == 'm' - assert ax.get_ylabel() == 'sec' - plt.close('all') diff --git a/lib/matplotlib/tests/test_widgets.py b/lib/matplotlib/tests/test_widgets.py index ce942964a313..2f9572822f64 100644 --- a/lib/matplotlib/tests/test_widgets.py +++ b/lib/matplotlib/tests/test_widgets.py @@ -1297,12 +1297,12 @@ def handle_positions(slider): else: return [h.get_xdata()[0] for h in slider._handles] - slider.set_val((0.2, 0.6)) - assert_allclose(slider.val, (0.2, 0.6)) - assert_allclose(handle_positions(slider), (0.2, 0.6)) + slider.set_val((0.4, 0.6)) + assert_allclose(slider.val, (0.4, 0.6)) + assert_allclose(handle_positions(slider), (0.4, 0.6)) box = slider.poly.get_extents().transformed(ax.transAxes.inverted()) - assert_allclose(box.get_points().flatten()[idx], [0.2, .25, 0.6, .75]) + assert_allclose(box.get_points().flatten()[idx], [0.4, .25, 0.6, .75]) slider.set_val((0.2, 0.1)) assert_allclose(slider.val, (0.1, 0.2)) diff --git a/lib/matplotlib/text.py b/lib/matplotlib/text.py index d20e06f204d8..9caa272a466b 100644 --- a/lib/matplotlib/text.py +++ b/lib/matplotlib/text.py @@ -367,7 +367,7 @@ def _get_layout(self, renderer): of a rotated text when necessary. """ thisx, thisy = 0.0, 0.0 - lines = self.get_text().split("\n") # Ensures lines is not empty. + lines = self._get_wrapped_text().split("\n") # Ensures lines is not empty. ws = [] hs = [] @@ -1626,6 +1626,9 @@ def draggable(self, state=None, use_blit=False): state : bool or None - True or False: set the draggability. - None: toggle the draggability. + use_blit : bool, default: False + Use blitting for faster image composition. For details see + :ref:`func-animation`. Returns ------- diff --git a/lib/matplotlib/widgets.py b/lib/matplotlib/widgets.py index dfc0450132c6..c25644dbe6b8 100644 --- a/lib/matplotlib/widgets.py +++ b/lib/matplotlib/widgets.py @@ -702,7 +702,7 @@ def __init__( valmin, valmax, valfmt, dragging, valstep) # Set a value to allow _value_in_bounds() to work. - self.val = [valmin, valmax] + self.val = (valmin, valmax) if valinit is None: # Place at the 25th and 75th percentiles extent = valmax - valmin @@ -947,9 +947,9 @@ def set_val(self, val): """ val = np.sort(val) _api.check_shape((2,), val=val) - vmin, vmax = val - vmin = self._min_in_bounds(vmin) - vmax = self._max_in_bounds(vmax) + # Reset value to allow _value_in_bounds() to work. + self.val = (self.valmin, self.valmax) + vmin, vmax = self._value_in_bounds(val) self._update_selection_poly(vmin, vmax) if self.orientation == "vertical": self._handles[0].set_ydata([vmin]) @@ -2512,7 +2512,7 @@ def remove_state(self, state): Parameters ---------- - value : str + state : str Must be a supported state of the selector. See the `state_modifier_keys` parameters for details. @@ -4244,7 +4244,7 @@ def onrelease(self, event): self.verts.append((event.xdata, event.ydata)) if len(self.verts) > 2: self.callback(self.verts) - self.ax.lines.remove(self.line) + self.line.remove() self.verts = None self.disconnect_events() diff --git a/requirements/doc/doc-requirements.txt b/requirements/doc/doc-requirements.txt index 9622bdab289f..392cdcd8b638 100644 --- a/requirements/doc/doc-requirements.txt +++ b/requirements/doc/doc-requirements.txt @@ -13,8 +13,8 @@ ipython ipywidgets numpydoc>=1.0 packaging>=20 -pydata-sphinx-theme>=0.12.0 -mpl-sphinx-theme>=3.7.0 +pydata-sphinx-theme~=0.12.0 +mpl-sphinx-theme~=3.7.0 sphinxcontrib-svg2pdfconverter>=1.1.0 sphinx-gallery>=0.10 sphinx-copybutton diff --git a/tools/cache_zenodo_svg.py b/tools/cache_zenodo_svg.py index 8a3c0450d626..a7a80603c602 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.0": "7637593", "v3.6.3": "7527665", "v3.6.2": "7275322", "v3.6.1": "7162185", diff --git a/tutorials/introductory/quick_start.py b/tutorials/introductory/quick_start.py index 2caacc5aee22..818f44847239 100644 --- a/tutorials/introductory/quick_start.py +++ b/tutorials/introductory/quick_start.py @@ -30,7 +30,12 @@ fig, ax = plt.subplots() # Create a figure containing a single axes. ax.plot([1, 2, 3, 4], [1, 4, 2, 3]) # Plot some data on the axes. -############################################################################### +# %% +# +# Note that to get this Figure to display, you may have to call ``plt.show()``, +# depending on your backend. For more details of Figures and backends, see +# :ref:`figure_explanation`. +# # .. _figure_parts: # # Parts of a Figure @@ -53,12 +58,17 @@ # fig = plt.figure() # an empty figure with no Axes # fig, ax = plt.subplots() # a figure with a single Axes # fig, axs = plt.subplots(2, 2) # a figure with a 2x2 grid of Axes +# # a figure with one axes on the left, and two on the right: +# fig, axs = plt.subplot_mosaic([['left', 'right-top'], +# ['left', 'right_bottom]]) # # It is often convenient to create the Axes together with the Figure, but you # can also manually add Axes later on. Note that many # :doc:`Matplotlib backends ` support zooming and # panning on figure windows. # +# For more on Figures, see :ref:`figure_explanation`. +# # :class:`~matplotlib.axes.Axes` # ------------------------------ #