Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ environment:
--cov-report= --cov=lib --log-level=DEBUG

matrix:
- PYTHON_VERSION: "3.11"
- PYTHON_VERSION: "3.12"

# We always use a 64-bit machine, but can build x86 distributions
# with the PYTHON_ARCH variable
Expand Down
20 changes: 1 addition & 19 deletions .github/workflows/cibuildwheel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ jobs:
- uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
name: Install Python
with:
python-version: '3.11'
python-version: '3.12'

# Something changed somewhere that prevents the downloaded-at-build-time
# licenses from being included in built wheels, so pre-download them so
Expand Down Expand Up @@ -176,24 +176,6 @@ jobs:
CIBW_BUILD: "cp312-*"
CIBW_ARCHS: ${{ matrix.cibw_archs }}

- name: Build wheels for CPython 3.11
uses: pypa/cibuildwheel@8d2b08b68458a16aeb24b64e68a09ab1c8e82084 # v3.4.1
with:
package-dir: dist/${{ needs.build_sdist.outputs.SDIST_NAME }}
env:
CIBW_BUILD: "cp311-*"
CIBW_ARCHS: ${{ matrix.cibw_archs }}

- name: Build wheels for PyPy
uses: pypa/cibuildwheel@8d2b08b68458a16aeb24b64e68a09ab1c8e82084 # v3.4.1
with:
package-dir: dist/${{ needs.build_sdist.outputs.SDIST_NAME }}
env:
CIBW_BUILD: "pp311-*"
CIBW_ARCHS: ${{ matrix.cibw_archs }}
CIBW_ENABLE: pypy
if: matrix.cibw_archs != 'aarch64' && matrix.os != 'windows-latest' && matrix.os != 'windows-11-arm'

- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: cibw-wheels-${{ runner.os }}-${{ matrix.cibw_archs }}
Expand Down
4 changes: 0 additions & 4 deletions .github/workflows/cygwin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -186,10 +186,6 @@ jobs:
python -c 'import PyQt5.QtCore' &&
echo 'PyQt5 is available' ||
echo 'PyQt5 is not available'
python -mpip install --upgrade pyside2 &&
python -c 'import PySide2.QtCore' &&
echo 'PySide2 is available' ||
echo 'PySide2 is not available'
python -m pip uninstall --yes wxpython || echo 'wxPython already uninstalled'

- name: Install Matplotlib
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/linting.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
- name: Set up Python 3
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
with:
python-version: '3.11'
python-version: '3.12'

- name: Install ruff
run: pip3 install ruff
Expand Down Expand Up @@ -66,7 +66,7 @@ jobs:
- name: Set up Python 3
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
with:
python-version: '3.11'
python-version: '3.12'

- name: Install mypy
run: pip3 install --group build --group typing
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/mypy-stubtest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
- name: Set up Python 3
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
with:
python-version: '3.11'
python-version: '3.12'

- name: Set up reviewdog
uses: reviewdog/action-setup@d8a7baabd7f3e8544ee4dbde3ee41d0011c3a93f # v1.5.0
Expand All @@ -33,7 +33,7 @@ jobs:
run: |
set -o pipefail
tox -e stubtest | \
sed -e "s!.tox/stubtest/lib/python3.11/site-packages!lib!g" | \
sed -e "s!.tox/stubtest/lib/python3.12/site-packages!lib!g" | \
reviewdog \
-efm '%Eerror: %m' \
-efm '%CStub: in file %f:%l' \
Expand Down
20 changes: 2 additions & 18 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,13 @@ jobs:
include:
- name-suffix: "(Minimum Versions)"
os: ubuntu-22.04
python-version: '3.11'
python-version: '3.12'
extra-requirements: '-c ci/minver-requirements.txt'
delete-font-cache: true
# https://github.com/matplotlib/matplotlib/issues/29844
pygobject-ver: '<3.52.0'
- os: ubuntu-22.04
python-version: '3.11'
python-version: '3.12'
CFLAGS: "-fno-lto" # Ensure that disabling LTO works.
extra-requirements: '--group test-extra'
# https://github.com/matplotlib/matplotlib/issues/29844
Expand All @@ -73,16 +73,10 @@ jobs:
python-version: '3.13t'
# https://github.com/matplotlib/matplotlib/issues/29844
pygobject-ver: '<3.52.0'
- os: ubuntu-24.04
python-version: '3.12'
- os: ubuntu-24.04
python-version: '3.14'
- os: ubuntu-24.04-arm
python-version: '3.12'
- os: macos-14 # This runner is on M1 (arm64) chips.
python-version: '3.11'
# https://github.com/matplotlib/matplotlib/issues/29732
pygobject-ver: '<3.52.0'
- os: macos-14 # This runner is on M1 (arm64) chips.
python-version: '3.12'
# https://github.com/matplotlib/matplotlib/issues/29732
Expand Down Expand Up @@ -267,16 +261,6 @@ jobs:
echo 'PyQt5 is available' ||
echo 'PyQt5 is not available'
fi
# Even though PySide2 wheels can be installed on Python 3.12+, they are broken and since PySide2 is
# deprecated, they are unlikely to be fixed. For the same deprecation reason, there are no wheels
# on M1 macOS, so don't bother there either.
if [[ "${{ matrix.os }}" != 'macos-14' && "${{ matrix.python-version }}" == '3.11'
]]; then
python -mpip install --upgrade pyside2 &&
python -c 'import PySide2.QtCore' &&
echo 'PySide2 is available' ||
echo 'PySide2 is not available'
fi
python -mpip install --upgrade --only-binary :all: pyqt6 &&
python -c 'import PyQt6.QtCore' &&
echo 'PyQt6 is available' ||
Expand Down
5 changes: 1 addition & 4 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,8 @@ stages:
- job: Pytest
strategy:
matrix:
Windows_py311:
vmImage: 'windows-2022' # Keep one job pinned to the oldest image
python.version: '3.11'
Windows_py312:
vmImage: 'windows-latest'
vmImage: 'windows-2022' # Keep one job pinned to the oldest image
python.version: '3.12'
Windows_py313:
vmImage: 'windows-latest'
Expand Down
4 changes: 2 additions & 2 deletions ci/minver-requirements.txt
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# Extra pip requirements for the minimum-version CI run

contourpy==1.0.1
contourpy==1.2.1
cycler==0.10
fonttools==4.22.0
importlib-resources==3.2.0
kiwisolver==1.3.2
meson-python==0.13.2
meson==1.1.0
numpy==1.25.0
numpy==2.0.0
packaging==20.0
pillow==9.0.1
pyparsing==3.0.0
Expand Down
19 changes: 9 additions & 10 deletions doc/api/backend_qt_api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,9 @@ a dependency to building the docs.
Qt Bindings
-----------

There are currently 2 actively supported Qt versions, Qt5 and Qt6, and two
supported Python bindings per version -- `PyQt5
<https://www.riverbankcomputing.com/static/Docs/PyQt5/>`_ and `PySide2
<https://doc.qt.io/qtforpython-5/contents.html>`_ for Qt5 and `PyQt6
There are currently 2 actively supported Qt versions, Qt5 and Qt6. `PyQt5
<https://www.riverbankcomputing.com/static/Docs/PyQt5/>`_ is the supported
Python binding for Qt5 and there are both `PyQt6
<https://www.riverbankcomputing.com/static/Docs/PyQt6/>`_ and `PySide6
<https://doc.qt.io/qtforpython/contents.html>`_ for Qt6 [#]_. Matplotlib's
qtagg and qtcairo backends (``matplotlib.backends.backend_qtagg`` and
Expand All @@ -35,13 +34,12 @@ parts factored out in the ``matplotlib.backends.backend_qt`` module.
At runtime, these backends select the actual binding used as follows:

1. If a binding's ``QtCore`` subpackage is already imported, that binding is
selected (the order for the check is ``PyQt6``, ``PySide6``, ``PyQt5``,
``PySide2``).
selected (the order for the check is ``PyQt6``, ``PySide6``, ``PyQt5``).
2. If the :envvar:`QT_API` environment variable is set to one of "PyQt6",
"PySide6", "PyQt5", "PySide2" (case-insensitive), that binding is selected.
"PySide6", "PyQt5" (case-insensitive), that binding is selected.
(See also the documentation on :ref:`environment-variables`.)
3. Otherwise, the first available backend in the order ``PyQt6``, ``PySide6``,
``PyQt5``, ``PySide2`` is selected.
``PyQt5`` is selected.

In the past, Matplotlib used to have separate backends for each version of Qt
(e.g. qt4agg/``matplotlib.backends.backend_qt4agg`` and
Expand All @@ -62,8 +60,9 @@ change without warning [#]_.

.. [#] There is also `PyQt4
<https://www.riverbankcomputing.com/static/Docs/PyQt4/>`_ and `PySide
<https://srinikom.github.io/pyside-docs/>`_ for Qt4 but these are no
longer supported by Matplotlib and upstream support for Qt4 ended
<https://srinikom.github.io/pyside-docs/>`_ for Qt4 and `PySide2
<https://doc.qt.io/qtforpython-5/contents.html>`_ for Qt5 but these are
no longer supported by Matplotlib. Upstream support for Qt4 ended
in 2015.
.. [#] Despite the slight API differences, the more important distinction
between the PyQt and Qt for Python series of bindings is licensing.
Expand Down
7 changes: 7 additions & 0 deletions doc/api/next_api_changes/deprecations/XXXXX_REC.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Direct modification of ``(Sub)Figure`` artist lists
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Previously it was possible to modify the ``artists``, ``images``, ``lines``,

Check warning on line 3 in doc/api/next_api_changes/deprecations/XXXXX_REC.rst

View workflow job for this annotation

GitHub Actions / sphinx

[sphinx] doc/api/next_api_changes/deprecations/XXXXX_REC.rst#L3

py:obj reference target not found: remove [ref.obj]
Raw output
doc/api/next_api_changes/deprecations/XXXXX_REC.rst:3: WARNING: py:obj reference target not found: remove [ref.obj]
``legends``, ``patches`` and ``texts`` attributes of `.Figure` and `.SubFigure`
instances using standard `list` functionality. This is now deprecated.
Instead use `~.Figure.add_artist` to add an artist to the figure, or use the
artist's `remove` method to remove it.
1 change: 1 addition & 0 deletions doc/devel/min_dep_policy.rst
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ specification of the dependencies.
========== ======== ======
Matplotlib Python NumPy
========== ======== ======
3.12 3.12 2.0.0
3.11 3.11 1.25.0
`3.10`_ 3.10 1.23.0
`3.9`_ 3.9 1.23.0
Expand Down
2 changes: 1 addition & 1 deletion doc/devel/testing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ You can also run tox on a subset of environments:

.. code-block:: bash

$ tox -e py310,py311
$ tox -e py312,py314

Tox processes environments sequentially by default,
which can be slow when testing multiple environments.
Expand Down
10 changes: 4 additions & 6 deletions doc/install/dependencies.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ When installing through a package manager like ``pip`` or ``conda``, the
mandatory dependencies are automatically installed. This list is mainly for
reference.

* `Python <https://www.python.org/downloads/>`_ (>= 3.11)
* `contourpy <https://pypi.org/project/contourpy/>`_ (>= 1.0.1)
* `Python <https://www.python.org/downloads/>`_ (>= 3.12)
* `contourpy <https://pypi.org/project/contourpy/>`_ (>= 1.2.1)
* `cycler <https://matplotlib.org/cycler/>`_ (>= 0.10.0)
* `dateutil <https://pypi.org/project/python-dateutil/>`_ (>= 2.7)
* `fontTools <https://fonttools.readthedocs.io/en/latest/>`_ (>= 4.22.0)
* `kiwisolver <https://github.com/nucleic/kiwi>`_ (>= 1.3.1)
* `NumPy <https://numpy.org>`_ (>= 1.25)
* `NumPy <https://numpy.org>`_ (>= 2.0)
* `packaging <https://pypi.org/project/packaging/>`_ (>= 20.0)
* `Pillow <https://pillow.readthedocs.io/en/latest/>`_ (>= 9.0)
* `pyparsing <https://pypi.org/project/pyparsing/>`_ (>= 3)
Expand Down Expand Up @@ -62,8 +62,7 @@ and the capabilities they provide.
* Tk_ (>= 8.5, != 8.6.0 or 8.6.1): for the Tk-based backends. Tk is part of
most standard Python installations, but it's not part of Python itself and
thus may not be present in rare cases.
* PyQt6_ (>= 6.1), PySide6_, PyQt5_ (>= 5.12), or PySide2_: for the Qt-based
backends.
* PyQt6_ (>= 6.1), PySide6_, or PyQt5_ (>= 5.12): for the Qt-based backends.
* PyGObject_ and pycairo_ (>= 1.14.0): for the GTK-based backends. If using pip
(but not conda or system package manager) PyGObject must be built from
source; see `pygobject documentation
Expand All @@ -78,7 +77,6 @@ and the capabilities they provide.

.. _Tk: https://docs.python.org/3/library/tk.html
.. _PyQt5: https://pypi.org/project/PyQt5/
.. _PySide2: https://pypi.org/project/PySide2/
.. _PyQt6: https://pypi.org/project/PyQt6/
.. _PySide6: https://pypi.org/project/PySide6/
.. _PyGObject: https://pygobject.readthedocs.io/en/latest/
Expand Down
6 changes: 3 additions & 3 deletions environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,20 @@ dependencies:
- cairocffi
- c-compiler
- cxx-compiler
- contourpy>=1.0.1
- contourpy>=1.2.1
- cycler>=0.10.0
- fonttools>=4.22.0
- importlib-resources>=3.2.0
- kiwisolver>=1.3.1
- pybind11>=2.13.2
- meson-python>=0.13.1
- numpy>=1.25
- numpy>=2.0
- pillow>=9
- pkg-config
- pygobject
- pyparsing>=3
- pyqt
- python>=3.11
- python>=3.12
- python-dateutil>=2.1
- setuptools_scm<10
- wxpython
Expand Down
7 changes: 2 additions & 5 deletions galleries/examples/units/basic_units.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@
import itertools
import math

from packaging.version import parse as parse_version

import numpy as np

import matplotlib.ticker as ticker
Expand Down Expand Up @@ -170,9 +168,8 @@ def __str__(self):
def __len__(self):
return len(self.value)

if parse_version(np.__version__) >= parse_version('1.20'):
def __getitem__(self, key):
return TaggedValue(self.value[key], self.unit)
def __getitem__(self, key):
return TaggedValue(self.value[key], self.unit)

def __iter__(self):
# Return a generator expression rather than use `yield`, so that
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
===========

Simple Qt application embedding Matplotlib canvases. This program will work
equally well using any Qt binding (PyQt6, PySide6, PyQt5, PySide2). The
equally well using any Qt binding (PyQt6, PySide6, PyQt5). The
binding can be selected by setting the :envvar:`QT_API` environment variable to
the binding name, or by first importing it.
"""
Expand Down
2 changes: 1 addition & 1 deletion galleries/examples/user_interfaces/mplcvd.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ def setup(figure):
break
if pkg == "gi":
_setup_gtk(tb)
elif pkg in ("PyQt5", "PySide2", "PyQt6", "PySide6"):
elif pkg in ("PyQt5", "PyQt6", "PySide6"):
_setup_qt(tb)
elif pkg == "tkinter":
_setup_tk(tb)
Expand Down
40 changes: 22 additions & 18 deletions galleries/tutorials/artists.py
Original file line number Diff line number Diff line change
Expand Up @@ -314,24 +314,26 @@ class in the Matplotlib API, and the one you will be working with most
#
#
# The figure also has its own ``images``, ``lines``, ``patches`` and ``text``
# attributes, which you can use to add primitives directly. When doing so, the
# default coordinate system for the ``Figure`` will simply be in pixels (which
# is not usually what you want). If you instead use Figure-level methods to add
# Artists (e.g., using `.Figure.text` to add text), then the default coordinate
# system will be "figure coordinates" where (0, 0) is the bottom-left of the
# figure and (1, 1) is the top-right of the figure.
#
# As with all ``Artist``\s, you can control this coordinate system by setting
# the transform property. You can explicitly use "figure coordinates" by
# setting the ``Artist`` transform to :attr:`!fig.transFigure`:
# attributes, which you can use to access any primitives that are its direct
# children. Adding images and text is usually achieved with the
# `~.Figure.figimage` and `~.Figure.text` methods. Other artists may be added
# with the `~.Figure.add_artist` method.
#
# As with all ``Artist``\s, you can control the coordinate system by setting
# the transform property (see :ref:`transforms_tutorial`). When using
# `~.Figure.figimage`, the default coordinate system is simply pixels. When
# using `~.Figure.text` or `~.Figure.add_artist`, the default coordinate system
# will be "figure coordinates" where (0, 0) is the bottom-left of the figure
# and (1, 1) is the top-right of the figure.

import matplotlib.lines as lines

fig = plt.figure()

l1 = lines.Line2D([0, 1], [0, 1], transform=fig.transFigure, figure=fig)
l2 = lines.Line2D([0, 1], [1, 0], transform=fig.transFigure, figure=fig)
fig.lines.extend([l1, l2])
line1 = lines.Line2D([0, 1], [0, 1])
line2 = lines.Line2D([0, 1], [1, 0])
for line in line1, line2:
fig.add_artist(line)

plt.show()

Expand All @@ -342,16 +344,18 @@ class in the Matplotlib API, and the one you will be working with most
# Figure attribute Description
# ================ ============================================================
# axes A list of `~.axes.Axes` instances
# subfigures A list of `.SubFigure` instances
# patch The `.Rectangle` background
# images A list of `.FigureImage` patches -
# images An `.ArtistList` of `.FigureImage` patches -
# useful for raw pixel display
# legends A list of Figure `.Legend` instances
# legends An `.ArtistList` of Figure `.Legend` instances
# (different from ``Axes.get_legend()``)
# lines A list of Figure `.Line2D` instances
# lines An `.ArtistList` of Figure `.Line2D` instances
# (rarely used, see ``Axes.lines``)
# patches A list of Figure `.Patch`\s
# patches An `.ArtistList` of Figure `.Patch`\s
# (rarely used, see ``Axes.patches``)
# texts A list Figure `.Text` instances
# texts An `.ArtistList` of Figure `.Text` instances
# artists An `.ArtistList` of all other `.Artist` instances
# ================ ============================================================
#
# .. _axes-container:
Expand Down
Loading
Loading