8000 Merge branch 'v3.10.1-doc' into v3.10.x · matplotlib/matplotlib@c0bc118 · GitHub
[go: up one dir, main page]

Skip to content

Commit c0bc118

Browse files
committed
Merge branch 'v3.10.1-doc' into v3.10.x
2 parents 939037f + 035a5d2 commit c0bc118

File tree

17 files changed

+257
-111
lines changed

17 files changed

+257
-111
lines changed

.github/workflows/tests.yml

Lines changed: 8 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ jobs:
4848
matrix:
4949
include:
5050
- name-suffix: "(Minimum Versions)"
51-
os: ubuntu-20.04
51+
os: ubuntu-22.04
5252
python-version: '3.10'
5353
extra-requirements: '-c requirements/testing/minver.txt'
5454
delete-font-cache: true
@@ -57,22 +57,9 @@ jobs:
5757
pyqt6-ver: '==6.2.0 PyQt6-Qt6==6.2.0'
5858
pyside2-ver: '==5.15.2.1'
5959
pyside6-ver: '==6.2.0'
60-
- os: ubuntu-20.04
61-
python-version: '3.10'
62-
# One CI run tests ipython/matplotlib-inline before backend mapping moved to mpl
63-
extra-requirements:
64-
-r requirements/testing/extra.txt
65-
"ipython==7.29.0"
66-
"ipykernel==5.5.6"
67-
"matplotlib-inline<0.1.7"
68-
CFLAGS: "-fno-lto" # Ensure that disabling LTO works.
69-
# https://github.com/matplotlib/matplotlib/pull/26052#issuecomment-1574595954
70-
# https://www.riverbankcomputing.com/pipermail/pyqt/2023-November/045606.html
71-
pyqt6-ver: '!=6.5.1,!=6.6.0,!=6.7.1'
72-
# https://bugreports.qt.io/projects/PYSIDE/issues/PYSIDE-2346
73-
pyside6-ver: '!=6.5.1'
7460
- os: ubuntu-22.04
7561
python-version: '3.11'
62+
CFLAGS: "-fno-lto" # Ensure that disabling LTO works.
7663
# https://www.riverbankcomputing.com/pipermail/pyqt/2023-November/045606.html
7764
pyqt6-ver: '!=6.6.0'
7865
# https://bugreports.qt.io/projects/PYSIDE/issues/PYSIDE-2346
@@ -103,10 +90,14 @@ jobs:
10390
pyside6-ver: '!=6.5.1'
10491
- os: macos-14 # This runner is on M1 (arm64) chips.
10592
python-version: '3.12'
93+
# https://github.com/matplotlib/matplotlib/issues/29732
94+
pygobject-ver: '<3.52.0'
10695
# https://bugreports.qt.io/projects/PYSIDE/issues/PYSIDE-2346
10796
pyside6-ver: '!=6.5.1'
10897
- os: macos-14 # This runner is on M1 (arm64) chips.
10998 F438
python-version: '3.13'
99+
# https://github.com/matplotlib/matplotlib/issues/29732
100+
pygobject-ver: '<3.52.0'
110101
# https://bugreports.qt.io/projects/PYSIDE/issues/PYSIDE-2346
111102
pyside6-ver: '!=6.5.1'
112103

@@ -176,11 +167,7 @@ jobs:
176167
texlive-luatex \
177168
texlive-pictures \
178169
texlive-xetex
179-
if [[ "${{ matrix.os }}" = ubuntu-20.04 ]]; then
180-
sudo apt-get install -yy --no-install-recommends libopengl0
181-
else # ubuntu-22.04
182-
sudo apt-get install -yy --no-install-recommends gir1.2-gtk-4.0
183-
fi
170+
sudo apt-get install -yy --no-install-recommends gir1.2-gtk-4.0
184171
;;
185172
macOS)
186173
brew update
@@ -270,7 +257,7 @@ jobs:
270257
# (sometimes, the install appears to be successful but shared
271258
# libraries cannot be loaded at runtime, so an actual import is a
272259
# better check).
273-
python -m pip install --upgrade pycairo 'cairocffi>=0.8' PyGObject &&
260+
python -m pip install --upgrade pycairo 'cairocffi>=0.8' 'PyGObject${{ matrix.pygobject-ver }}' &&
274261
(
275262
python -c 'import gi; gi.require_version("Gtk", "4.0"); from gi.repository import Gtk' &&
276263
echo 'PyGObject 4 is available' || echo 'PyGObject 4 is not available'

doc/_static/mpl.css

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,3 +207,15 @@ div.wide-table table th.stub {
207207
.section-toc.toctree-wrapper li>ul{
208208
padding-inline-start:0;
209209
}
210+
211+
.sidebar-cheatsheets {
212+
margin-bottom: 3em;
213+
}
214+
215+
.sidebar-cheatsheets > h3 {
216+
margin-top: 0;
217+
}
218+
219+
.sidebar-cheatsheets > img {
220+
width: 100%;
221+
}

doc/_static/zenodo_cache/14940554.svg

Lines changed: 35 additions & 0 deletions
Loading

doc/_templates/cheatsheet_sidebar.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11

22
<div class="sidebar-cheatsheets">
3-
<h3>Matplotlib cheatsheets</h3>
3+
<h3>Cheatsheets</h3>
44
<a href="https://matplotlib.org/cheatsheets/">
55
<img src="_static/mpl_cheatsheet1.png"
66
alt="Matplotlib cheatsheets"

doc/index.rst

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,34 @@ Install
2929
3030
conda install -c conda-forge matplotlib
3131
32+
.. tab-item:: pixi
33+
34+
.. code-block:: bash
35+
36+
pixi add matplotlib
37+
38+
.. tab-item:: uv
39+
40+
.. code-block:: bash
41+
42+
uv add matplotlib
43+
44+
.. warning::
45+
46+
If you install Python with ``uv`` then the ``tkagg`` backend
47+
will not be available because python-build-standalone (used by uv
48+
to distribute Python) does not contain tk bindings that are usable by
49+
Matplotlib (see `this issue`_ for details). If you want Matplotlib
50+
to be able to display plots in a window, you should install one of
51+
the other :ref:`supported GUI frameworks <optional_dependencies>`,
52+
e.g.
53+
54+
.. code-block:: bash
55+
56+
uv add matplotlib pyside6
57+
58+
.. _this issue: https://github.com/astral-sh/uv/issues/6893#issuecomment-2565965851
59+
3260
.. tab-item:: other
3361

3462
.. rst-class:: section-toc

doc/install/index.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@ precompiled wheel for your OS and Python.
2828
The following backends work out of the box: Agg, ps, pdf, svg
2929

3030
Python is typically shipped with tk bindings which are used by
31-
TkAgg.
31+
TkAgg. Notably, python-build-standalone – used by ``uv`` – does
32+
not include tk bindings that are usable by Matplotlib.
3233

3334
For support of other GUI frameworks, LaTeX rendering, saving
3435
animations and a larger selection of file formats, you can

doc/project/citing.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ By version
3232
.. START OF AUTOGENERATED
3333
3434
35+
v3.10.1
36+
.. image:: ../_static/zenodo_cache/14940554.svg
37+
:target: https://doi.org/10.5281/zenodo.14940554
3538
v3.10.0
3639
.. image:: ../_static/zenodo_cache/14464227.svg
3740
:target: https://doi.org/10.5281/zenodo.14464227

environment.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ dependencies:
5353
# testing
5454
- black<24
5555
- coverage
56-
- flake8>=3.8
56+
- flake8>=3.8,<7.2
5757
- flake8-docstrings>=1.4.0
5858
- gtk4
5959
- ipykernel

galleries/examples/scales/logit_demo.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,20 @@
44
===========
55
66
Examples of plots with logit axes.
7+
8+
This example visualises how ``set_yscale("logit")`` works on probability plots
9+
by generating three distributions: normal, laplacian, and cauchy in one plot.
10+
11+
The advantage of logit scale is that it effectively spreads out values close to 0 and 1.
12+
13+
In a linear scale plot, probability values near 0 and 1 appear compressed,
14+
making it difficult to see differences in those regions.
15+
16+
In a logit scale plot, the transformation expands these regions,
17+
making the graph cleaner and easier to compare across different probability values.
18+
19+
This makes the logit scale especially useful when visalising probabilities in logistic
20+
regression, classification models, and cumulative distribution functions.
721
"""
822

923
import math

galleries/examples/shapes_and_collections/hatch_style_reference.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,3 +62,7 @@ def hatches_plot(ax, h):
6262
# - `matplotlib.patches.Rectangle`
6363
# - `matplotlib.axes.Axes.add_patch`
6464
# - `matplotlib.axes.Axes.text`
65+
#
66+
# .. tags::
67+
#
68+
# purpose: reference

galleries/examples/text_labels_and_annotations/fancyarrow_demo.py

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,11 @@
33
Annotation arrow style reference
44
================================
55
6-
Overview of the arrow styles available in `~.Axes.annotate`.
6+
Overview of the available `.ArrowStyle` settings. These are used for the *arrowstyle*
7+
parameter of `~.Axes.annotate` and `.FancyArrowPatch`.
8+
9+
Each style can be configured with a set of parameters, which are stated along with
10+
their default values.
711
"""
812

913
import inspect
@@ -12,42 +16,38 @@
1216

1317
import matplotlib.pyplot as plt
1418

15-
import matplotlib.patches as mpatches
19+
from matplotlib.patches import ArrowStyle
1620

17-
styles = mpatches.ArrowStyle.get_styles()
21+
styles = ArrowStyle.get_styles()
1822
ncol = 2
1923
nrow = (len(styles) + 1) // ncol
20-
axs = (plt.figure(figsize=(4 * ncol, 1 + nrow))
21-
.add_gridspec(1 + nrow, ncol,
22-
wspace=.7, left=.1, right=.9, bottom=0, top=1).subplots())
24+
gridspec_kw = dict(wspace=0, hspace=0.05, left=0, right=1, bottom=0, top=1)
25+
fig, axs = plt.subplots(1 + nrow, ncol,
26+
figsize=(4 * ncol, 1 + nrow), gridspec_kw=gridspec_kw)
2327
for ax in axs.flat:
28+
ax.set_xlim(-0.1, 4)
2429
ax.set_axis_off()
2530
for ax in axs[0, :]:
26-
ax.text(0, .5, "arrowstyle",
27-
transform=ax.transAxes, size="large", color="tab:blue",
28-
horizontalalignment="center", verticalalignment="center")
29-
ax.text(.35, .5, "default parameters",
30-
transform=ax.transAxes,
31-
horizontalalignment="left", verticalalignment="center")
31+
ax.text(0, 0.5, "arrowstyle", size="large", color="tab:blue")
32+
ax.text(1.4, .5, "default parameters", size="large")
3233
for ax, (stylename, stylecls) in zip(axs[1:, :].T.flat, styles.items()):
33-
l, = ax.plot(.25, .5, "ok", transform=ax.transAxes)
34-
ax.annotate(stylename, (.25, .5), (-0.1, .5),
35-
xycoords="axes fraction", textcoords="axes fraction",
36-
size="large", color="tab:blue",
37-
horizontalalignment="center", verticalalignment="center",
34+
# draw dot and annotation with arrowstyle
35+
l, = ax.plot(1.25, 0, "o", color="darkgrey")
36+
ax.annotate(stylename, (1.25, 0), (0, 0),
37+
size="large", color="tab:blue", va="center", family="monospace",
3838
arrowprops=dict(
39-
arrowstyle=stylename, connectionstyle="arc3,rad=-0.05",
40-
color="k", shrinkA=5, shrinkB=5, patchB=l,
39+
arrowstyle=stylename, connectionstyle="arc3,rad=0",
40+
color="black", shrinkA=5, shrinkB=5, patchB=l,
4141
),
42-
bbox=dict(boxstyle="square", fc="w"))
42+
bbox=dict(boxstyle="square", fc="w", ec="darkgrey"))
43+
# draw default parameters
4344
# wrap at every nth comma (n = 1 or 2, depending on text length)
4445
s = str(inspect.signature(stylecls))[1:-1]
4546
n = 2 if s.count(',') > 3 else 1
46-
ax.text(.35, .5,
47+
ax.text(1.4, 0,
4748
re.sub(', ', lambda m, c=itertools.count(1): m.group()
4849
if next(c) % n else '\n', s),
49-
transform=ax.transAxes,
50-
horizontalalignment="left", verticalalignment="center")
50+
verticalalignment="center", color="0.3")
5151

5252
plt.show()
5353

galleries/examples/units/basic_units.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,14 @@
55
Basic units
66
===========
77
8+
9+
This file implements a units library that supports registering arbitrary units,
10+
conversions between units, and math with unitized data. This library also implements a
11+
Matplotlib unit converter and registers its units with Matplotlib. This library is used
12+
in the examples to demonstrate Matplotlib's unit support. It is only maintained for the
13+
purposes of building documentation and should never be used outside of the Matplotlib
14+
documentation.
15+
816
"""
917

1018
import itertools

0 commit comments

Comments
 (0)
0