Skip to content

Commit 02163e1

Browse files
authored
Merge pull request #202 from cphyc/issue/201
Remove warning from mpl 3.10 (closes #201)
2 parents e775eac + 4c58b9f commit 02163e1

File tree

3 files changed

+9
-4
lines changed

3 files changed

+9
-4
lines changed

.github/workflows/pytest.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
strategy:
1616
fail-fast: false
1717
matrix:
18-
python-version: ["3.11"]
18+
python-version: ["3.11", "3.13"]
1919

2020
steps:
2121
- uses: actions/checkout@v4

labellines/core.py

+6-1
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,12 @@ def labelLines(
238238
xvals[i] = new_xv # type: ignore
239239

240240
# Convert float values back to datetime in case of datetime axis
241-
if isinstance(ax.xaxis.converter, DateConverter):
241+
mpl_version = tuple(int(_) for _ in plt.matplotlib.__version__.split("."))
242+
if mpl_version < (3, 10, 0):
243+
converter = ax.xaxis.converter
244+
else:
245+
converter = ax.xaxis.get_converter()
246+
if isinstance(converter, DateConverter):
242247
xvals = [
243248
num2date(x).replace(tzinfo=ax.xaxis.get_units())
244249
for x in xvals # type: ignore

pyproject.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,10 @@ dependencies = [
3131

3232
[project.optional-dependencies]
3333
test = [
34-
"matplotlib==3.9.3",
34+
"matplotlib==3.10.0",
3535
"pytest-cov==6.0.0",
3636
"pytest-mpl==0.17.0",
37-
"pytest==8.3.3",
37+
"pytest==8.3.4",
3838
]
3939

4040
[project.urls]

0 commit comments

Comments
 (0)