Skip to content

Commit 6d3ae81

Browse files
authored
Merge branch 'matplotlib:main' into main
2 parents 9897de2 + 38a8e15 commit 6d3ae81

File tree

165 files changed

+4207
-1485
lines changed

Some content is hidden

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

165 files changed

+4207
-1485
lines changed

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,13 @@ out the development guide https://matplotlib.org/devdocs/devel/index.html
44
-->
55

66
## PR summary
7-
<!-- Please provide at least 1-2 sentences describing the pull request in detail
8-
(Why is this change required? What problem does it solve?) and link to relevant
9-
issues and PRs.
7+
<!-- Please describe the pull request, using the questions below as guidance, and link to any relevant issues and PRs:
108
11-
Also please summarize the changes in the title, for example "Raise ValueError on
9+
- Why is this change necessary?
10+
- What problem does it solve?
11+
- What is the reasoning for this implementation?
12+
13+
Additionally, please summarize the changes in the title, for example "Raise ValueError on
1214
non-numeric input to set_xlim" and avoid non-descriptive titles such as "Addresses
1315
issue #8576".
1416
-->

.github/workflows/cibuildwheel.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,4 +234,4 @@ jobs:
234234
subject-path: dist/matplotlib-*
235235

236236
- name: Publish package distributions to PyPI
237-
uses: pypa/gh-action-pypi-publish@f7600683efdcb7656dec5b29656edb7bc586e597 # v1.10.3
237+
uses: pypa/gh-action-pypi-publish@fb13cb306901256ace3dab689990e13a5550ffaa # v1.11.0

.github/workflows/tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ jobs:
266266
python -m pip install --upgrade $PRE \
267267
'contourpy>=1.0.1' cycler fonttools kiwisolver importlib_resources \
268268
packaging pillow 'pyparsing!=3.1.0' python-dateutil setuptools-scm \
269-
'meson-python>=0.13.1' 'pybind11>=2.6' \
269+
'meson-python>=0.13.1' 'pybind11>=2.13.2' \
270270
-r requirements/testing/all.txt \
271271
${{ matrix.extra-requirements }}
272272

doc/api/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
scalarmappable.gen_rst

doc/api/axis_api.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,8 @@ Units
169169
Axis.convert_units
170170
Axis.set_units
171171
Axis.get_units
172+
Axis.set_converter
173+
Axis.get_converter
172174
Axis.update_units
173175

174176

doc/api/cm_api.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,5 @@
66
:members:
77
:undoc-members:
88
:show-inheritance:
9+
10+
.. include:: scalarmappable.gen_rst

doc/api/colorizer_api.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
************************
2+
``matplotlib.colorizer``
3+
************************
4+
5+
.. automodule:: matplotlib.colorizer
6+
:members:
7+
:undoc-members:
8+
:show-inheritance:
9+
:private-members: _ColorizerInterface, _ScalarMappable

doc/api/colors_api.rst

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ Color norms
3232
SymLogNorm
3333
TwoSlopeNorm
3434

35-
Colormaps
36-
---------
35+
Univariate Colormaps
36+
--------------------
3737

3838
.. autosummary::
3939
:toctree: _as_gen/
@@ -43,6 +43,17 @@ Colormaps
4343
LinearSegmentedColormap
4444
ListedColormap
4545

46+
Multivariate Colormaps
47+
----------------------
48+
49+
.. autosummary::
50+
:toctree: _as_gen/
51+
:template: autosummary.rst
52+
53+
BivarColormap
54+
SegmentedBivarColormap
55+
BivarColormapFromImage
56+
4657
Other classes
4758
-------------
4859

doc/api/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ Alphabetical list of modules:
9393
cm_api.rst
9494
collections_api.rst
9595
colorbar_api.rst
96+
colorizer_api.rst
9697
colors_api.rst
9798
container_api.rst
9899
contour_api.rst
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
``NavigationToolbar2.save_figure`` now returns filepath of saved figure
2+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3+
4+
``NavigationToolbar2.save_figure`` function may return the filename of the saved figure.
5+
6+
If a backend implements this functionality it should return `None`
7+
in the case where no figure is actually saved (because the user closed the dialog without saving).
8+
9+
If the backend does not or can not implement this functionality (currently the Gtk4 backends
10+
and webagg backends do not) this method will return ``NavigationToolbar2.UNKNOWN_SAVED_STATUS``.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
Changing ``Figure.number``
2+
~~~~~~~~~~~~~~~~~~~~~~~~~~
3+
4+
Changing ``Figure.number`` is deprecated. This value is used by `.pyplot`
5+
to identify figures. It must stay in sync with the pyplot internal state
6+
and is not intended to be modified by the user.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
``PdfFile.hatchPatterns``
2+
~~~~~~~~~~~~~~~~~~~~~~~~~
3+
4+
... is deprecated.
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
ft2font module-level constants replaced by enums
2+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3+
4+
The `.ft2font`-level constants have been converted to `enum` classes, and all API using
5+
them now take/return the new types.
6+
7+
The following constants are now part of `.ft2font.Kerning` (without the ``KERNING_``
8+
prefix):
9+
10+
- ``KERNING_DEFAULT``
11+
- ``KERNING_UNFITTED``
12+
- ``KERNING_UNSCALED``
13+
14+
The following constants are now part of `.ft2font.LoadFlags` (without the ``LOAD_``
15+
prefix):
16+
17+
- ``LOAD_DEFAULT``
18+
- ``LOAD_NO_SCALE``
19+
- ``LOAD_NO_HINTING``
20+
- ``LOAD_RENDER``
21+
- ``LOAD_NO_BITMAP``
22+
- ``LOAD_VERTICAL_LAYOUT``
23+
- ``LOAD_FORCE_AUTOHINT``
24+
- ``LOAD_CROP_BITMAP``
25+
- ``LOAD_PEDANTIC``
26+
- ``LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH``
27+
- ``LOAD_NO_RECURSE``
28+
- ``LOAD_IGNORE_TRANSFORM``
29+
- ``LOAD_MONOCHROME``
30+
- ``LOAD_LINEAR_DESIGN``
31+
- ``LOAD_NO_AUTOHINT``
32+
- ``LOAD_TARGET_NORMAL``
33+
- ``LOAD_TARGET_LIGHT``
34+
- ``LOAD_TARGET_MONO``
35+
- ``LOAD_TARGET_LCD``
36+
- ``LOAD_TARGET_LCD_V``
37+
38+
The following constants are now part of `.ft2font.FaceFlags`:
39+
40+
- ``EXTERNAL_STREAM``
41+
- ``FAST_GLYPHS``
42+
- ``FIXED_SIZES``
43+
- ``FIXED_WIDTH``
44+
- ``GLYPH_NAMES``
45+
- ``HORIZONTAL``
46+
- ``KERNING``
47+
- ``MULTIPLE_MASTERS``
48+
- ``SCALABLE``
49+
- ``SFNT``
50+
- ``VERTICAL``
51+
52+
The following constants are now part of `.ft2font.StyleFlags`:
53+
54+
- ``ITALIC``
55+
- ``BOLD``
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
Calling ``pyplot.polar()`` with an existing non-polar Axes
2+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3+
4+
This currently plots the data into the non-polar Axes, ignoring
5+
the "polar" intention. This usage scenario is deprecated and
6+
will raise an error in the future.
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
Passing floating-point values to ``RendererAgg.draw_text_image``
2+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3+
4+
Any floating-point values passed to the *x* and *y* parameters were truncated to integers
5+
silently. This behaviour is now deprecated, and only `int` values should be used.
6+
7+
Passing floating-point values to ``FT2Image``
8+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
9+
10+
Any floating-point values passed to the `.FT2Image` constructor, or the *x0*, *y0*, *x1*,
11+
and *y1* parameters of `.FT2Image.draw_rect_filled` were truncated to integers silently.
12+
This behaviour is now deprecated, and only `int` values should be used.

doc/conf.py

Lines changed: 54 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929

3030
import matplotlib
3131

32-
3332
# debug that building expected version
3433
print(f"Building Documentation for Matplotlib: {matplotlib.__version__}")
3534

@@ -269,7 +268,7 @@ def autodoc_process_bases(app, name, obj, options, bases):
269268
'scipy': ('https://docs.scipy.org/doc/scipy/', None),
270269
'tornado': ('https://www.tornadoweb.org/en/stable/', None),
271270
'xarray': ('https://docs.xarray.dev/en/stable/', None),
272-
'meson-python': ('https://meson-python.readthedocs.io/en/stable/', None),
271+
'meson-python': ('https://mesonbuild.com/meson-python/', None),
273272
'pip': ('https://pip.pypa.io/en/stable/', None),
274273
}
275274

@@ -853,6 +852,58 @@ def linkcode_resolve(domain, info):
853852
extensions.append('sphinx.ext.viewcode')
854853

855854

855+
def generate_ScalarMappable_docs():
856+
857+
import matplotlib.colorizer
858+
from numpydoc.docscrape_sphinx import get_doc_object
859+
from pathlib import Path
860+
import textwrap
861+
from sphinx.util.inspect import stringify_signature
862+
target_file = Path(__file__).parent / 'api' / 'scalarmappable.gen_rst'
863+
with open(target_file, 'w') as fout:
864+
fout.write("""
865+
.. class:: ScalarMappable(colorizer, **kwargs)
866+
:canonical: matplotlib.colorizer._ScalarMappable
867+
868+
""")
869+
for meth in [
870+
matplotlib.colorizer._ScalarMappable.autoscale,
871+
matplotlib.colorizer._ScalarMappable.autoscale_None,
872+
matplotlib.colorizer._ScalarMappable.changed,
873+
"""
874+
.. attribute:: colorbar
875+
876+
The last colorbar associated with this ScalarMappable. May be None.
877+
""",
878+
matplotlib.colorizer._ScalarMappable.get_alpha,
879+
matplotlib.colorizer._ScalarMappable.get_array,
880+
matplotlib.colorizer._ScalarMappable.get_clim,
881+
matplotlib.colorizer._ScalarMappable.get_cmap,
882+
"""
883+
.. property:: norm
884+
""",
885+
matplotlib.colorizer._ScalarMappable.set_array,
886+
matplotlib.colorizer._ScalarMappable.set_clim,
887+
matplotlib.colorizer._ScalarMappable.set_cmap,
888+
matplotlib.colorizer._ScalarMappable.set_norm,
889+
matplotlib.colorizer._ScalarMappable.to_rgba,
890+
]:
891+
if isinstance(meth, str):
892+
fout.write(meth)
893+
else:
894+
name = meth.__name__
895+
sig = stringify_signature(inspect.signature(meth))
896+
docstring = textwrap.indent(
897+
str(get_doc_object(meth)),
898+
' '
899+
).rstrip()
900+
fout.write(f"""
901+
.. method:: {name}{sig}
902+
{docstring}
903+
904+
""")
905+
906+
856907
# -----------------------------------------------------------------------------
857908
# Sphinx setup
858909
# -----------------------------------------------------------------------------
@@ -866,3 +917,4 @@ def setup(app):
866917
app.connect('autodoc-process-bases', autodoc_process_bases)
867918
if sphinx.version_info[:2] < (7, 1):
868919
app.connect('html-page-context', add_html_cache_busting, priority=1000)
920+
generate_ScalarMappable_docs()

doc/devel/api_changes.rst

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,3 +239,20 @@ What's new notes
239239
.. include:: ../users/next_whats_new/README.rst
240240
:start-after: whats-new-guide-start
241241
:end-before: whats-new-guide-end
242+
243+
Discourage API
244+
--------------
245+
246+
We have API that we do not recommend anymore for new code, but that cannot be
247+
deprecated because its removal would be breaking backward-compatibility and too
248+
disruptive. In such a case we can formally discourage API. This can cover
249+
specific parameters, call patterns, whole methods etc.
250+
251+
To do so, add a note to the docstring ::
252+
253+
.. admonition:: Discouraged
254+
255+
[description and suggested alternative]
256+
257+
You find several examples for good descriptions if you search the codebase for
258+
``.. admonition:: Discouraged``.

0 commit comments

Comments
 (0)