|
8 | 8 |
|
9 | 9 | warnings.filterwarnings("ignore") |
10 | 10 |
|
| 11 | +def _get_pad(ax: Axes, **kwargs) -> float: |
| 12 | + extrapad = kwargs.get("extrapad", 0.05) |
| 13 | + return ax.get_xlim()[1] + extrapad*(ax.get_xlim()[1] - ax.get_xlim()[0]) |
11 | 14 |
|
12 | 15 | def draw_ci( |
13 | 16 | dataframe: pd.core.frame.DataFrame, |
@@ -227,8 +230,7 @@ def draw_pval_right( |
227 | 230 | if pd.isna(yticklabel2): |
228 | 231 | yticklabel2 = "" |
229 | 232 |
|
230 | | - extrapad = 0.05 |
231 | | - pad = ax.get_xlim()[1] * (1 + extrapad) |
| 233 | + pad = _get_pad(ax, **kwargs) |
232 | 234 | t = ax.text( |
233 | 235 | x=pad, |
234 | 236 | y=yticklabel1, |
@@ -324,8 +326,7 @@ def draw_yticklabel2( |
324 | 326 | yticklabel1 = row["yticklabel"] |
325 | 327 | yticklabel2 = row["yticklabel2"] |
326 | 328 |
|
327 | | - extrapad = 0.05 |
328 | | - pad = ax.get_xlim()[1] * (1 + extrapad) |
| 329 | + pad = _get_pad(ax, **kwargs) |
329 | 330 | if (ix == top_row_ix) and ( |
330 | 331 | annoteheaders is not None or right_annoteheaders is not None |
331 | 332 | ): |
@@ -694,8 +695,7 @@ def draw_tablelines( |
694 | 695 | [x0, x1], [nrows - 1.45, nrows - 1.45], color="0.5", linewidth=lower_lw, clip_on=False |
695 | 696 | ) |
696 | 697 | if (right_annoteheaders is not None) or (pval is not None): |
697 | | - extrapad = kwargs.get("extrapad", 0.05) |
698 | | - x0 = ax.get_xlim()[1] * (1 + extrapad) |
| 698 | + x0 = _get_pad(ax, **kwargs) |
699 | 699 | plt.plot( |
700 | 700 | [x0, righttext_width], |
701 | 701 | [nrows - 0.4, nrows - 0.4], |
|
0 commit comments