Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit5ff0dd6

Browse files
committed
Merge remote-tracking branch 'upstream/main' into align-titles
2 parents5203166 +394b80d commit5ff0dd6

File tree

51 files changed

+588
-305
lines changed

Some content is hidden

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

51 files changed

+588
-305
lines changed

‎.github/workflows/cibuildwheel.yml

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -116,10 +116,6 @@ jobs:
116116
CIBW_SKIP:"*-musllinux_aarch64"
117117
CIBW_TEST_COMMAND:>-
118118
python {package}/ci/check_version_number.py
119-
# Apple Silicon machines are not available for testing, so silence the
120-
# warning from cibuildwheel. Remove the skip when they're available.
121-
CIBW_TEST_SKIP:"*-macosx_arm64"
122-
MACOSX_DEPLOYMENT_TARGET:"10.12"
123119
MPL_DISABLE_FH4:"yes"
124120
strategy:
125121
matrix:
@@ -131,7 +127,15 @@ jobs:
131127
-os:windows-latest
132128
cibw_archs:"auto64"
133129
-os:macos-11
134-
cibw_archs:"x86_64 arm64"
130+
cibw_archs:"x86_64"
131+
# NOTE: macos_target can be moved back into global environment after
132+
# meson-python 0.16.0 is released.
133+
macos_target:"10.12"
134+
-os:macos-14
135+
cibw_archs:"arm64"
136+
# NOTE: macos_target can be moved back into global environment after
137+
# meson-python 0.16.0 is released.
138+
macos_target:"11.0"
135139

136140
steps:
137141
-name:Set up QEMU
@@ -153,6 +157,7 @@ jobs:
153157
env:
154158
CIBW_BUILD:"cp312-*"
155159
CIBW_ARCHS:${{ matrix.cibw_archs }}
160+
MACOSX_DEPLOYMENT_TARGET:"${{ matrix.macos_target }}"
156161

157162
-name:Build wheels for CPython 3.11
158163
uses:pypa/cibuildwheel@8d945475ac4b1aac4ae08b2fd27db9917158b6ce# v2.17.0
@@ -161,6 +166,7 @@ jobs:
161166
env:
162167
CIBW_BUILD:"cp311-*"
163168
CIBW_ARCHS:${{ matrix.cibw_archs }}
169+
MACOSX_DEPLOYMENT_TARGET:"${{ matrix.macos_target }}"
164170

165171
-name:Build wheels for CPython 3.10
166172
uses:pypa/cibuildwheel@8d945475ac4b1aac4ae08b2fd27db9917158b6ce# v2.17.0
@@ -169,6 +175,7 @@ jobs:
169175
env:
170176
CIBW_BUILD:"cp310-*"
171177
CIBW_ARCHS:${{ matrix.cibw_archs }}
178+
MACOSX_DEPLOYMENT_TARGET:"${{ matrix.macos_target }}"
172179

173180
-name:Build wheels for CPython 3.9
174181
uses:pypa/cibuildwheel@8d945475ac4b1aac4ae08b2fd27db9917158b6ce# v2.17.0
@@ -177,6 +184,7 @@ jobs:
177184
env:
178185
CIBW_BUILD:"cp39-*"
179186
CIBW_ARCHS:${{ matrix.cibw_archs }}
187+
MACOSX_DEPLOYMENT_TARGET:"${{ matrix.macos_target }}"
180188

181189
-name:Build wheels for PyPy
182190
uses:pypa/cibuildwheel@8d945475ac4b1aac4ae08b2fd27db9917158b6ce# v2.17.0
@@ -185,6 +193,7 @@ jobs:
185193
env:
186194
CIBW_BUILD:"pp39-*"
187195
CIBW_ARCHS:${{ matrix.cibw_archs }}
196+
MACOSX_DEPLOYMENT_TARGET:"${{ matrix.macos_target }}"
188197
if:matrix.cibw_archs != 'aarch64'
189198

190199
-uses:actions/upload-artifact@v4

‎.github/workflows/tests.yml

Lines changed: 25 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -87,10 +87,14 @@ jobs:
8787
pyqt6-ver:'!=6.6.0'
8888
# https://bugreports.qt.io/projects/PYSIDE/issues/PYSIDE-2346
8989
pyside6-ver:'!=6.5.1'
90-
-os:macos-latest
90+
-os:macos-12# This runnre is on Intel chips.
9191
python-version:3.9
9292
# https://bugreports.qt.io/projects/PYSIDE/issues/PYSIDE-2346
9393
pyside6-ver:'!=6.5.1'
94+
-os:macos-14# This runner is on M1 (arm64) chips.
95+
python-version:'3.12'
96+
# https://bugreports.qt.io/projects/PYSIDE/issues/PYSIDE-2346
97+
pyside6-ver:'!=6.5.1'
9498

9599
steps:
96100
-uses:actions/checkout@v4
@@ -157,7 +161,8 @@ jobs:
157161
macOS)
158162
brew install ccache
159163
brew tap homebrew/cask-fonts
160-
brew install font-noto-sans-cjk gobject-introspection gtk4 ninja
164+
brew install font-noto-sans-cjk ghostscript gobject-introspection gtk4 ninja
165+
brew install --cask inkscape
161166
;;
162167
esac
163168
@@ -228,7 +233,6 @@ jobs:
228233
# (sometimes, the install appears to be successful but shared
229234
# libraries cannot be loaded at runtime, so an actual import is a
230235
# better check).
231-
# PyGObject, pycairo, and cariocffi do not install on macOS 10.12.
232236
python -m pip install --upgrade pycairo 'cairocffi>=0.8' PyGObject &&
233237
(
234238
python -c 'import gi; gi.require_version("Gtk", "4.0"); from gi.repository import Gtk' &&
@@ -238,43 +242,35 @@ jobs:
238242
echo 'PyGObject 3 is available' || echo 'PyGObject 3 is not available'
239243
)
240244
241-
# There are no functioning wheels available for macOS 10.12 (as of
242-
# Sept 2020) for either pyqt5 (there are only wheels for 10.13+) or
243-
# pyside2 (the latest version (5.13.2) with 10.12 wheels has a
244-
# fatal to us bug, it was fixed in 5.14.0 which has 10.13 wheels)
245245
python -mpip install --upgrade pyqt5${{ matrix.pyqt5-ver }} &&
246246
python -c 'import PyQt5.QtCore' &&
247247
echo 'PyQt5 is available' ||
248248
echo 'PyQt5 is not available'
249-
if [[ "${{ runner.os }}" != 'macOS'
249+
# Even though PySide2 wheels can be installed on Python 3.12, they are broken and since PySide2 is
250+
# deprecated, they are unlikely to be fixed. For the same deprecation reason, there are no wheels
251+
# on M1 macOS, so don't bother there either.
252+
if [[ "${{ matrix.os }}" != 'macos-14'
250253
&& "${{ matrix.python-version }}" != '3.12' ]]; then
251254
python -mpip install --upgrade pyside2${{ matrix.pyside2-ver }} &&
252255
python -c 'import PySide2.QtCore' &&
253256
echo 'PySide2 is available' ||
254257
echo 'PySide2 is not available'
255258
fi
256-
if [[ "${{ runner.os }}" != 'macOS' ]]; then
257-
python -mpip install --upgrade pyqt6${{ matrix.pyqt6-ver }} &&
258-
python -c 'import PyQt6.QtCore' &&
259-
echo 'PyQt6 is available' ||
260-
echo 'PyQt6 is not available'
261-
fi
262-
if [[ "${{ runner.os }}" != 'macOS'
263-
&& "${{ matrix.python-version }}" != '3.12' ]]; then
264-
python -mpip install --upgrade pyside6${{ matrix.pyside6-ver }} &&
265-
python -c 'import PySide6.QtCore' &&
266-
echo 'PySide6 is available' ||
267-
echo 'PySide6 is not available'
268-
fi
259+
python -mpip install --upgrade pyqt6${{ matrix.pyqt6-ver }} &&
260+
python -c 'import PyQt6.QtCore' &&
261+
echo 'PyQt6 is available' ||
262+
echo 'PyQt6 is not available'
263+
python -mpip install --upgrade pyside6${{ matrix.pyside6-ver }} &&
264+
python -c 'import PySide6.QtCore' &&
265+
echo 'PySide6 is available' ||
266+
echo 'PySide6 is not available'
269267
270-
if [[ "${{ matrix.python-version }}" != '3.12' ]]; then
271-
python -mpip install --upgrade \
272-
-f "https://extras.wxpython.org/wxPython4/extras/linux/gtk3/${{ matrix.os }}" \
273-
wxPython &&
274-
python -c 'import wx' &&
275-
echo 'wxPython is available' ||
276-
echo 'wxPython is not available'
277-
fi
268+
python -mpip install --upgrade \
269+
-f "https://extras.wxpython.org/wxPython4/extras/linux/gtk3/${{ matrix.os }}" \
270+
wxPython &&
271+
python -c 'import wx' &&
272+
echo 'wxPython is available' ||
273+
echo 'wxPython is not available'
278274
279275
-name:Install the nightly dependencies
280276
# Only install the nightly dependencies during the scheduled event

‎.pre-commit-config.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ repos:
2828
-id:trailing-whitespace
2929
exclude_types:[svg]
3030
-repo:https://github.com/pre-commit/mirrors-mypy
31-
rev:v1.8.0
31+
rev:v1.9.0
3232
hooks:
3333
-id:mypy
3434
additional_dependencies:
@@ -42,7 +42,7 @@ repos:
4242
files:lib/matplotlib# Only run when files in lib/matplotlib are changed.
4343
pass_filenames:false
4444
-repo:https://github.com/pycqa/flake8
45-
rev:6.1.0
45+
rev:7.0.0
4646
hooks:
4747
-id:flake8
4848
additional_dependencies:
@@ -74,12 +74,12 @@ repos:
7474
-sphinx>=1.8.1
7575
-tomli
7676
-repo:https://github.com/adrienverge/yamllint
77-
rev:v1.29.0
77+
rev:v1.35.1
7878
hooks:
7979
-id:yamllint
8080
args:["--strict", "--config-file=.yamllint.yml"]
8181
-repo:https://github.com/python-jsonschema/check-jsonschema
82-
rev:0.28.0
82+
rev:0.28.1
8383
hooks:
8484
# TODO: Re-enable this when https://github.com/microsoft/azure-pipelines-vscode/issues/567 is fixed.
8585
# - id: check-azure-pipelines

‎doc/devel/testing.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ The correct target folder can be found using::
315315

316316
python -c "import matplotlib.tests; print(matplotlib.tests.__file__.rsplit('/', 1)[0])"
317317

318-
An analogous copying of:file:`lib/mpl_toolkits/tests/baseline_images`
318+
An analogous copying of:file:`lib/mpl_toolkits/*/tests/baseline_images`
319319
is necessary for testing ``mpl_toolkits``.
320320

321321
Run the tests
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
Add ``widths``, ``heights`` and ``angles`` setter to ``EllipseCollection``
2+
--------------------------------------------------------------------------
3+
4+
The ``widths``, ``heights`` and ``angles`` values of the `~matplotlib.collections.EllipseCollection`
5+
can now be changed after the collection has been created.
6+
7+
..plot::
8+
:include-source: true
9+
10+
import matplotlib.pyplot as plt
11+
from matplotlib.collections import EllipseCollection
12+
import numpy as np
13+
14+
rng = np.random.default_rng(0)
15+
16+
widths = (2, )
17+
heights = (3, )
18+
angles = (45, )
19+
offsets = rng.random((10, 2)) * 10
20+
21+
fig, ax = plt.subplots()
22+
23+
ec = EllipseCollection(
24+
widths=widths,
25+
heights=heights,
26+
angles=angles,
27+
offsets=offsets,
28+
units='x',
29+
offset_transform=ax.transData,
30+
)
31+
32+
ax.add_collection(ec)
33+
ax.set_xlim(-2, 12)
34+
ax.set_ylim(-2, 12)
35+
36+
new_widths = rng.random((10, 2)) * 2
37+
new_heights = rng.random((10, 2)) * 3
38+
new_angles = rng.random((10, 2)) * 180
39+
40+
ec.set(widths=new_widths, heights=new_heights, angles=new_angles)
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
Percent sign in pie labels auto-escaped with ``usetex=True``
2+
------------------------------------------------------------
3+
4+
It is common, with `.Axes.pie`, to specify labels that include a percent sign
5+
(``%``), which denotes a comment for LaTeX. When enabling LaTeX with
6+
:rc:`text.usetex` or passing ``textprops={"usetex": True}``, this would cause
7+
the percent sign to disappear.
8+
9+
Now, the percent sign is automatically escaped (by adding a preceding
10+
backslash) so that it appears regardless of the ``usetex`` setting. If you have
11+
pre-escaped the percent sign, this will be detected, and remain as is.

‎galleries/examples/lines_bars_and_markers/timeline.py

Lines changed: 44 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -28,31 +28,28 @@
2828
data=json.loads(urllib.request.urlopen(url,timeout=1).read().decode())
2929

3030
dates= []
31-
names= []
31+
releases= []
3232
foritemindata:
3333
if'rc'notinitem['tag_name']and'b'notinitem['tag_name']:
3434
dates.append(item['published_at'].split("T")[0])
35-
names.append(item['tag_name'])
36-
# Convert date strings (e.g. 2014-10-18) to datetime
37-
dates= [datetime.strptime(d,"%Y-%m-%d")fordindates]
35+
releases.append(item['tag_name'].lstrip("v"))
3836

3937
exceptException:
4038
# In case the above fails, e.g. because of missing internet connection
4139
# use the following lists as fallback.
42-
names= ['v2.2.4','v3.0.3','v3.0.2','v3.0.1','v3.0.0','v2.2.3',
43-
'v2.2.2','v2.2.1','v2.2.0','v2.1.2','v2.1.1','v2.1.0',
44-
'v2.0.2','v2.0.1','v2.0.0','v1.5.3','v1.5.2','v1.5.1',
45-
'v1.5.0','v1.4.3','v1.4.2','v1.4.1','v1.4.0']
46-
40+
releases= ['2.2.4','3.0.3','3.0.2','3.0.1','3.0.0','2.2.3',
41+
'2.2.2','2.2.1','2.2.0','2.1.2','2.1.1','2.1.0',
42+
'2.0.2','2.0.1','2.0.0','1.5.3','1.5.2','1.5.1',
43+
'1.5.0','1.4.3','1.4.2','1.4.1','1.4.0']
4744
dates= ['2019-02-26','2019-02-26','2018-11-10','2018-11-10',
4845
'2018-09-18','2018-08-10','2018-03-17','2018-03-16',
4946
'2018-03-06','2018-01-18','2017-12-10','2017-10-07',
5047
'2017-05-10','2017-05-02','2017-01-17','2016-09-09',
5148
'2016-07-03','2016-01-10','2015-10-29','2015-02-16',
5249
'2014-10-26','2014-10-18','2014-08-26']
5350

54-
# Convert date strings (e.g. 2014-10-18)todatetime
55-
dates= [datetime.strptime(d,"%Y-%m-%d")fordindates]
51+
dates= [datetime.strptime(d,"%Y-%m-%d")fordindates]# Convert strstodates.
52+
dates,releases=zip(*sorted(zip(dates,releases)))# Sort by increasing date.
5653

5754
# %%
5855
# Next, we'll create a stem plot with some variation in levels as to
@@ -64,32 +61,45 @@
6461
#
6562
# Note that Matplotlib will automatically plot datetime inputs.
6663

67-
68-
# Choose some nice levels
69-
levels=np.tile([-5,5,-3,3,-1,1],
70-
int(np.ceil(len(dates)/6)))[:len(dates)]
71-
72-
# Create figure and plot a stem plot with the date
64+
# Choose some nice levels: alternate minor releases between top and bottom, and
65+
# progressievly shorten the stems for bugfix releases.
66+
levels= []
67+
major_minor_releases=sorted({release[:3]forreleaseinreleases})
68+
forreleaseinreleases:
69+
major_minor=release[:3]
70+
bugfix=int(release[4])
71+
h=1+0.8* (5-bugfix)
72+
level=hifmajor_minor_releases.index(major_minor)%2==0else-h
73+
levels.append(level)
74+
75+
# The figure and the axes.
7376
fig,ax=plt.subplots(figsize=(8.8,4),layout="constrained")
7477
ax.set(title="Matplotlib release dates")
7578

76-
ax.vlines(dates,0,levels,color="tab:red")# The vertical stems.
77-
ax.plot(dates,np.zeros_like(dates),"-o",
78-
color="k",markerfacecolor="w")# Baseline and markers on it.
79-
80-
# annotate lines
81-
ford,l,rinzip(dates,levels,names):
82-
ax.annotate(r,xy=(d,l),
83-
xytext=(-3,np.sign(l)*3),textcoords="offset points",
84-
horizontalalignment="right",
85-
verticalalignment="bottom"ifl>0else"top")
86-
87-
# format x-axis with 4-month intervals
88-
ax.xaxis.set_major_locator(mdates.MonthLocator(interval=4))
89-
ax.xaxis.set_major_formatter(mdates.DateFormatter("%b %Y"))
90-
plt.setp(ax.get_xticklabels(),rotation=30,ha="right")
91-
92-
# remove y-axis and spines
79+
# The vertical stems.
80+
ax.vlines(dates,0,levels,
81+
color=[("tab:red",1ifrelease.endswith(".0")else.5)
82+
forreleaseinreleases])
83+
# The baseline.
84+
ax.axhline(0,c="black")
85+
# The markers on the baseline.
86+
minor_dates= [datefordate,releaseinzip(dates,releases)ifrelease[-1]=='0']
87+
bugfix_dates= [datefordate,releaseinzip(dates,releases)ifrelease[-1]!='0']
88+
ax.plot(bugfix_dates,np.zeros_like(bugfix_dates),"ko",mfc="white")
89+
ax.plot(minor_dates,np.zeros_like(minor_dates),"ko",mfc="tab:red")
90+
91+
# Annotate the lines.
92+
fordate,level,releaseinzip(dates,levels,releases):
93+
ax.annotate(release,xy=(date,level),
94+
xytext=(-3,np.sign(level)*3),textcoords="offset points",
95+
verticalalignment="bottom"iflevel>0else"top",
96+
weight="bold"ifrelease.endswith(".0")else"normal",
97+
bbox=dict(boxstyle='square',pad=0,lw=0,fc=(1,1,1,0.7)))
98+
99+
ax.yaxis.set(major_locator=mdates.YearLocator(),
100+
major_formatter=mdates.DateFormatter("%Y"))
101+
102+
# Remove the y-axis and some spines.
93103
ax.yaxis.set_visible(False)
94104
ax.spines[["left","top","right"]].set_visible(False)
95105

‎galleries/examples/subplots_axes_and_figures/secondary_axis.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ def inverse(x):
154154

155155
ax.plot(dates,temperature)
156156
ax.set_ylabel(r'$T\ [^oC]$')
157-
plt.xticks(rotation=70)
157+
ax.xaxis.set_tick_params(rotation=70)
158158

159159

160160
defdate2yday(x):

‎galleries/examples/ticks/ticklabels_rotation.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,16 @@
55
66
Demo of custom tick-labels with user-defined rotation.
77
"""
8+
89
importmatplotlib.pyplotasplt
910

1011
x= [1,2,3,4]
1112
y= [1,4,9,6]
1213
labels= ['Frogs','Hogs','Bogs','Slogs']
1314

14-
plt.plot(x,y)
15+
fig,ax=plt.subplots()
16+
ax.plot(x,y)
1517
# You can specify a rotation for the tick labels in degrees or with keywords.
16-
plt.xticks(x,labels,rotation='vertical')
17-
# Pad margins so that markers don't get clipped by the Axes
18-
plt.margins(0.2)
19-
# Tweak spacing to prevent clipping of tick-labels
20-
plt.subplots_adjust(bottom=0.15)
18+
ax.set_xticks(x,labels,rotation='vertical')
19+
2120
plt.show()

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp