Skip to content

Commit 501eb12

Browse files
committed
Remove warning from mpl 3.10
1 parent e775eac commit 501eb12

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

labellines/core.py

Lines changed: 6 additions & 1 deletion
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

0 commit comments

Comments
 (0)