Skip to content

Commit

Permalink
Troubleshooting mpl Tick label..
Browse files Browse the repository at this point in the history
  • Loading branch information
LSYS committed Dec 14, 2023
1 parent b0f508f commit dccec4f
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions forestplot/graph_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,10 +175,16 @@ def right_flush_yticklabels(
dataframe[yticklabel], fontfamily=fontfamily, fontsize=fontsize, ha="right"
)
yax = ax.get_yaxis()
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
)
if flush:
yax.set_tick_params(pad=pad)

Expand Down

0 comments on commit dccec4f

Please sign in to comment.