Skip to content

Commit

Permalink
Fix compatibility with newer mpl versions (#82)
Browse files Browse the repository at this point in the history
  • Loading branch information
LSYS committed Dec 16, 2023
1 parent ab93c4c commit 09af3d4
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions forestplot/mplot_graph_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,16 @@ def mdraw_yticklabels(
)
yax = ax.get_yaxis()
fig = plt.gcf()
pad = max(
T.label.get_window_extent(renderer=fig.canvas.get_renderer()).width
for T in yax.majorTicks
)
try:
pad = max(
T.label.get_window_extent(renderer=fig.canvas.get_renderer()).width
for T in yax.majorTicks
)
except AttributeError:
pad = max(
T.label1.get_window_extent(renderer=fig.canvas.get_renderer()).width
for T in yax.majorTicks
)
yax.set_tick_params(pad=pad)
else:
ax.set_yticklabels(
Expand Down

0 comments on commit 09af3d4

Please sign in to comment.