Skip to content

Commit

Permalink
Remove warning from mpl 3.10
Browse files Browse the repository at this point in the history
  • Loading branch information
cphyc committed Feb 5, 2025
1 parent e775eac commit 501eb12
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion labellines/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,12 @@ def labelLines(
xvals[i] = new_xv # type: ignore

# Convert float values back to datetime in case of datetime axis
if isinstance(ax.xaxis.converter, DateConverter):
mpl_version = tuple(int(_) for _ in plt.matplotlib.__version__.split("."))
if mpl_version < (3, 10, 0):
converter = ax.xaxis.converter
else:
converter = ax.xaxis.get_converter()
if isinstance(converter, DateConverter):
xvals = [
num2date(x).replace(tzinfo=ax.xaxis.get_units())
for x in xvals # type: ignore
Expand Down

0 comments on commit 501eb12

Please sign in to comment.