Skip to content

Commit 7be8ccf

Browse files
committed
Merge remote-tracking branch 'upstream/main' into resample_bug
2 parents 427cadc + 716d046 commit 7be8ccf

File tree

135 files changed

+2010
-924
lines changed

Some content is hidden

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

135 files changed

+2010
-924
lines changed

.github/workflows/cibuildwheel.yml

Lines changed: 21 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,16 @@ permissions:
2424
jobs:
2525
build_sdist:
2626
if: >-
27-
github.event_name == 'push' ||
28-
github.event_name == 'pull_request' && (
29-
(
30-
github.event.action == 'labeled' &&
31-
github.event.label.name == 'CI: Run cibuildwheel'
32-
) ||
33-
contains(github.event.pull_request.labels.*.name,
34-
'CI: Run cibuildwheel')
27+
github.repository == 'matplotlib/matplotlib' && (
28+
github.event_name == 'push' ||
29+
github.event_name == 'pull_request' && (
30+
(
31+
github.event.action == 'labeled' &&
32+
github.event.label.name == 'CI: Run cibuildwheel'
33+
) ||
34+
contains(github.event.pull_request.labels.*.name,
35+
'CI: Run cibuildwheel')
36+
)
3537
)
3638
name: Build sdist
3739
runs-on: ubuntu-latest
@@ -78,14 +80,16 @@ jobs:
7880

7981
build_wheels:
8082
if: >-
81-
github.event_name == 'push' ||
82-
github.event_name == 'pull_request' && (
83-
(
84-
github.event.action == 'labeled' &&
85-
github.event.label.name == 'CI: Run cibuildwheel'
86-
) ||
87-
contains(github.event.pull_request.labels.*.name,
88-
'CI: Run cibuildwheel')
83+
github.repository == 'matplotlib/matplotlib' && (
84+
github.event_name == 'push' ||
85+
github.event_name == 'pull_request' && (
86+
(
87+
github.event.action == 'labeled' &&
88+
github.event.label.name == 'CI: Run cibuildwheel'
89+
) ||
90+
contains(github.event.pull_request.labels.*.name,
91+
'CI: Run cibuildwheel')
92+
)
8993
)
9094
needs: build_sdist
9195
name: Build wheels on ${{ matrix.os }} for ${{ matrix.cibw_archs }}
@@ -183,7 +187,7 @@ jobs:
183187
if-no-files-found: error
184188

185189
publish:
186-
if: github.event_name == 'push' && github.ref_type == 'tag'
190+
if: github.repository == 'matplotlib/matplotlib' && github.event_name == 'push' && github.ref_type == 'tag'
187191
name: Upload release to PyPI
188192
needs: [build_sdist, build_wheels]
189193
runs-on: ubuntu-latest

.github/workflows/circleci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
steps:
1212
- name: GitHub Action step
1313
uses:
14-
scientific-python/circleci-artifacts-redirector-action@4e13a10d89177f4bfc8007a7064bdbeda848d8d1 # v1.0.0
14+
scientific-python/circleci-artifacts-redirector-action@7eafdb60666f57706a5525a2f5eb76224dc8779b # v1.1.0
1515
with:
1616
repo-token: ${{ secrets.GITHUB_TOKEN }}
1717
api-token: ${{ secrets.CIRCLECI_TOKEN }}

.github/workflows/codeql-analysis.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ on:
1212

1313
jobs:
1414
analyze:
15+
if: github.repository == 'matplotlib/matplotlib'
1516
name: Analyze
1617
runs-on: ubuntu-latest
1718
permissions:
@@ -31,7 +32,7 @@ jobs:
3132
persist-credentials: false
3233

3334
- name: Initialize CodeQL
34-
uses: github/codeql-action/init@60168efe1c415ce0f5521ea06d5c2062adbeed1b # v3.28.17
35+
uses: github/codeql-action/init@ff0a06e83cb2de871e5a09832bc6a81e7276941f # v3.28.18
3536
with:
3637
languages: ${{ matrix.language }}
3738

@@ -42,4 +43,4 @@ jobs:
4243
pip install --user -v .
4344
4445
- name: Perform CodeQL Analysis
45-
uses: github/codeql-action/analyze@60168efe1c415ce0f5521ea06d5c2062adbeed1b # v3.28.17
46+
uses: github/codeql-action/analyze@ff0a06e83cb2de871e5a09832bc6a81e7276941f # v3.28.18

.github/workflows/conflictcheck.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ on:
1111

1212
jobs:
1313
main:
14+
if: github.repository == 'matplotlib/matplotlib'
1415
runs-on: ubuntu-latest
1516
permissions:
1617
pull-requests: write

.github/workflows/reviewdog.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
1414
with:
1515
fetch-depth: 0
16-
- uses: actions/setup-python@8d9ed9ac5c53483de85588cdf95a591a75ab9f55 # v5.5.0
16+
- uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
1717
with:
1818
python-version: "3.x"
1919
- uses: pre-commit/action@2c7b3805fd2a0fd8c1884dcaebf91fc102a13ecd # v3.0.1

.github/workflows/tests.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,10 @@ jobs:
6464
python-version: '3.12'
6565
# https://github.com/matplotlib/matplotlib/issues/29844
6666
pygobject-ver: '<3.52.0'
67-
- os: ubuntu-22.04
67+
- name-suffix: "(Extra TeX packages)"
68+
os: ubuntu-22.04
6869
python-version: '3.13'
70+
extra-packages: 'texlive-fonts-extra texlive-lang-cyrillic'
6971
# https://github.com/matplotlib/matplotlib/issues/29844
7072
pygobject-ver: '<3.52.0'
7173
- name-suffix: "Free-threaded"
@@ -142,7 +144,8 @@ jobs:
142144
texlive-latex-recommended \
143145
texlive-luatex \
144146
texlive-pictures \
145-
texlive-xetex
147+
texlive-xetex \
148+
${{ matrix.extra-packages }}
146149
if [[ "${{ matrix.name-suffix }}" != '(Minimum Versions)' ]]; then
147150
sudo apt-get install -yy --no-install-recommends ffmpeg poppler-utils
148151
fi
@@ -396,7 +399,7 @@ jobs:
396399
fi
397400
- name: Upload code coverage
398401
if: ${{ !cancelled() && github.event_name != 'schedule' }}
399-
uses: codecov/codecov-action@ad3126e916f78f00edff4ed0317cf185271ccc2d # v5.4.2
402+
uses: codecov/codecov-action@18283e04ce6e62d37312384ff67231eb8fd56d24 # v5.4.3
400403
with:
401404
name: "${{ matrix.python-version }} ${{ matrix.os }} ${{ matrix.name-suffix }}"
402405
token: ${{ secrets.CODECOV_TOKEN }}

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ exclude: |
1010
doc/devel/gitwash|
1111
doc/users/prev|
1212
doc/api/prev|
13-
lib/matplotlib/tests/tinypages
13+
lib/matplotlib/tests/data/tinypages
1414
)
1515
repos:
1616
- repo: https://github.com/pre-commit/pre-commit-hooks

doc/_embedded_plots/grouped_bar.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import matplotlib.pyplot as plt
2+
3+
categories = ['A', 'B']
4+
data0 = [1.0, 3.0]
5+
data1 = [1.4, 3.4]
6+
data2 = [1.8, 3.8]
7+
8+
fig, ax = plt.subplots(figsize=(4, 2.2))
9+
ax.grouped_bar(
10+
[data0, data1, data2],
11+
tick_labels=categories,
12+
labels=['dataset 0', 'dataset 1', 'dataset 2'],
13+
colors=['#1f77b4', '#58a1cf', '#abd0e6'],
14+
)
15+
ax.legend()

doc/api/axes_api.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ Basic
6767
Axes.bar
6868
Axes.barh
6969
Axes.bar_label
70+
Axes.grouped_bar
7071

7172
Axes.stem
7273
Axes.eventplot

doc/api/bezier_api.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,5 @@
55
.. automodule:: matplotlib.bezier
66
:members:
77
:undoc-members:
8+
:special-members: __call__
89
:show-inheritance:
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
``PdfFile.fontNames``, ``PdfFile.dviFontNames``, ``PdfFile.type1Descriptors``
2-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1+
``PdfFile.fontNames``, ``PdfFile.dviFontInfo``, ``PdfFile.type1Descriptors``
2+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
33
... are deprecated with no replacement.
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
``FT2Image``
2+
~~~~~~~~~~~~
3+
... is deprecated. Use 2D uint8 ndarrays instead. In particular:
4+
5+
- The ``FT2Image`` constructor took ``width, height`` as separate parameters
6+
but the ndarray constructor takes ``(height, width)`` as single tuple
7+
parameter.
8+
- `.FT2Font.draw_glyph_to_bitmap` now (also) takes 2D uint8 arrays as input.
9+
- ``FT2Image.draw_rect_filled`` should be replaced by directly setting pixel
10+
values to black.
11+
- The ``image`` attribute of the object returned by ``MathTextParser("agg").parse``
12+
is now a 2D uint8 array.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
``BezierSegment.point_at_t``
2+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3+
4+
... is deprecated. Instead, it is possible to call the BezierSegment with an argument.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
*fontfile* parameter of ``PdfFile.createType1Descriptor``
2+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3+
This parameter is deprecated; all relevant pieces of information are now
4+
directly extracted from the *t1font* argument.
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
``apply_theta_transforms`` option in ``PolarTransform``
2+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3+
4+
Applying theta transforms in `~matplotlib.projections.polar.PolarTransform` and
5+
`~matplotlib.projections.polar.InvertedPolarTransform` has been removed, and
6+
the ``apply_theta_transforms`` keyword argument removed from both classes.
7+
8+
If you need to retain the behaviour where theta values
9+
are transformed, chain the ``PolarTransform`` with a `~matplotlib.transforms.Affine2D`
10+
transform that performs the theta shift and/or sign shift.
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
``TransformNode.is_bbox``
2+
^^^^^^^^^^^^^^^^^^^^^^^^^
3+
4+
... is removed. Instead check the object using ``isinstance(..., BboxBase)``.
5+
6+
``rcsetup.interactive_bk``, ``rcsetup.non_interactive_bk`` and ``rcsetup.all_backends``
7+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
8+
9+
... are removed and replaced by ``matplotlib.backends.backend_registry.list_builtin``
10+
with the following arguments
11+
12+
- ``matplotlib.backends.BackendFilter.INTERACTIVE``
13+
- ``matplotlib.backends.BackendFilter.NON_INTERACTIVE``
14+
- ``None``
15+
16+
``BboxTransformToMaxOnly``
17+
^^^^^^^^^^^^^^^^^^^^^^^^^^
18+
19+
... is removed. It can be replaced by ``BboxTransformTo(LockableBbox(bbox, x0=0, y0=0))``.
20+
21+
*interval* parameter of ``TimerBase.start``
22+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
23+
The timer interval parameter can no longer be set while starting it. The interval can be specified instead in the timer constructor, or by setting the timer.interval attribute.

doc/api/pyplot_summary.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ Basic
6060
bar
6161
barh
6262
bar_label
63+
grouped_bar
6364
stem
6465
eventplot
6566
pie

doc/devel/document.rst

Lines changed: 58 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -399,11 +399,14 @@ expression in the Matplotlib figure. In these cases, you can use the
399399

400400
.. _writing-docstrings:
401401

402-
Write docstrings
403-
================
402+
Write API documentation
403+
=======================
404404

405-
Most of the API documentation is written in docstrings. These are comment
406-
blocks in source code that explain how the code works.
405+
The API reference documentation describes the library interfaces, e.g. inputs, outputs,
406+
and expected behavior. Most of the API documentation is written in docstrings. These are
407+
comment blocks in source code that explain how the code works. All docstrings should
408+
conform to the `numpydoc docstring guide`_. Much of the ReST_ syntax discussed above
409+
(:ref:`writing-rest-pages`) can be used for links and references.
407410

408411
.. note::
409412

@@ -412,11 +415,11 @@ blocks in source code that explain how the code works.
412415
you may see in the source code. Pull requests updating docstrings to
413416
the current style are very welcome.
414417

415-
All new or edited docstrings should conform to the `numpydoc docstring guide`_.
416-
Much of the ReST_ syntax discussed above (:ref:`writing-rest-pages`) can be
417-
used for links and references. These docstrings eventually populate the
418-
:file:`doc/api` directory and form the reference documentation for the
419-
library.
418+
The pages in :file:`doc/api` are purely technical definitions of
419+
layout; therefore new API reference documentation should be added to the module
420+
docstrings. This placement keeps all API reference documentation about a module in the
421+
same file. These module docstrings eventually populate the :file:`doc/api` directory
422+
and form the reference documentation for the library.
420423

421424
Example docstring
422425
-----------------
@@ -534,6 +537,10 @@ understandable by humans. If the possible types are too complex use a
534537
simplification for the type description and explain the type more
535538
precisely in the text.
536539

540+
We do not use formal type annotation syntax for type descriptions in
541+
docstrings; e.g. we use ``list of str`` rather than ``list[str]``; we
542+
use ``int or str`` rather than ``int | str`` or ``Union[int, str]``.
543+
537544
Generally, the `numpydoc docstring guide`_ conventions apply. The following
538545
rules expand on them where the numpydoc conventions are not specific.
539546

@@ -866,6 +873,26 @@ Plots can also be directly placed inside docstrings. Details are in
866873
An advantage of this style over referencing an example script is that the
867874
code will also appear in interactive docstrings.
868875

876+
.. _inheritance-diagrams:
877+
878+
Generate inheritance diagrams
879+
-----------------------------
880+
881+
Class inheritance diagrams can be generated with the Sphinx
882+
`inheritance-diagram`_ directive.
883+
884+
.. _inheritance-diagram: https://www.sphinx-doc.org/en/master/usage/extensions/inheritance.html
885+
886+
Example:
887+
888+
.. code-block:: rst
889+
890+
.. inheritance-diagram:: matplotlib.patches matplotlib.lines matplotlib.text
891+
:parts: 2
892+
893+
.. inheritance-diagram:: matplotlib.patches matplotlib.lines matplotlib.text
894+
:parts: 2
895+
869896
.. _writing-examples-and-tutorials:
870897

871898
Write examples and tutorials
@@ -1115,6 +1142,28 @@ The current width limit (induced by *pydata-sphinx-theme*) is 720px, i.e.
11151142
``figsize=(7.2, ...)``, or 896px if the page does not have subsections and
11161143
thus does not have the "On this page" navigation on the right-hand side.
11171144

1145+
1146+
Plot types guidelines
1147+
---------------------
1148+
1149+
The :ref:`plot_types` gallery provides an overview of the types of visualizations that
1150+
Matplotlib provides out of the box, meaning that there is a high-level API for
1151+
generating each type of chart. Additions to this gallery are generally discouraged
1152+
because this gallery is heavily curated and tightly scoped to methods on
1153+
`matplotlib.axes.Axes`.
1154+
1155+
Format
1156+
^^^^^^
1157+
:title: Method signature with required arguments, e.g. ``plot(x, y)``
1158+
:description: In one sentence, describe the visualization that the method produces and
1159+
link to the API documentation, e.g. *Draws a bar chart. See ~Axes.bar*.
1160+
When necessary, add an additional sentence explaining the use case for
1161+
this function vs a very similar one, e.g. stairs vs step.
1162+
:plot: Use data with a self explanatory structure to illustrate the type of data this
1163+
plotting method is typically used for.
1164+
:code: The code should be about 5-10 lines with minimal customization. Plots in
1165+
this gallery use the ``_mpl-gallery`` stylesheet for a uniform aesthetic.
1166+
11181167
Miscellaneous
11191168
=============
11201169

@@ -1151,28 +1200,6 @@ Use the full path for this directive, relative to the doc root at
11511200
found by users at ``http://matplotlib.org/stable/old_topic/old_info2``.
11521201
For clarity, do not use relative links.
11531202

1154-
1155-
.. _inheritance-diagrams:
1156-
1157-
Generate inheritance diagrams
1158-
-----------------------------
1159-
1160-
Class inheritance diagrams can be generated with the Sphinx
1161-
`inheritance-diagram`_ directive.
1162-
1163-
.. _inheritance-diagram: https://www.sphinx-doc.org/en/master/usage/extensions/inheritance.html
1164-
1165-
Example:
1166-
1167-
.. code-block:: rst
1168-
1169-
.. inheritance-diagram:: matplotlib.patches matplotlib.lines matplotlib.text
1170-
:parts: 2
1171-
1172-
.. inheritance-diagram:: matplotlib.patches matplotlib.lines matplotlib.text
1173-
:parts: 2
1174-
1175-
11761203
Navbar and style
11771204
----------------
11781205

doc/install/dependencies.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -443,7 +443,8 @@ will often automatically include these collections.
443443
| | `lm <https://ctan.org/pkg/lm>`_, |
444444
| | `txfonts <https://ctan.org/pkg/txfonts>`_ |
445445
+-----------------------------+--------------------------------------------------+
446-
| collection-latex | `geometry <https://ctan.org/pkg/geometry>`_, |
446+
| collection-latex | `fix-cm <https://ctan.org/pkg/fix-cm>`_, |
447+
| | `geometry <https://ctan.org/pkg/geometry>`_, |
447448
| | `hyperref <https://ctan.org/pkg/hyperref>`_, |
448449
| | `latex <https://ctan.org/pkg/latex>`_, |
449450
| | latex-bin, |

0 commit comments

Comments
 (0)