Skip to content

Commit

Permalink
Fix for older matplotlib, but warn
Browse files Browse the repository at this point in the history
  • Loading branch information
Phlya committed Mar 10, 2023
1 parent f1a772e commit 6f01dc4
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion adjustText/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,15 @@ def adjust_text(
return
if ax is None:
ax = plt.gca()
ax.figure.draw_without_rendering()
try:
ax.figure.draw_without_rendering()
except AttributeError:
logging.warn(
"""Looks like you are using an old matplotlib version.
In some cases adjust_text might fail, if possible update
matplotlib to version >=3.5.0"""
)
ax.figure.canvas.draw()
try:
transform = texts[0].get_transform()
except IndexError:
Expand Down

0 comments on commit 6f01dc4

Please sign in to comment.