Nearly done with fig_invariance_thresh_lp_species.pdf (WIP).

This commit is contained in:
j-hartling
2026-03-27 16:09:40 +01:00
parent 92ee4eda6f
commit 411d50ffcf
3 changed files with 187 additions and 93 deletions

View File

@@ -18,6 +18,8 @@ def hide_axis(ax, side='bottom'):
def get_trans_artist(artist):
artist_type = type(artist).__name__
if 'Transform' in artist_type:
return artist
if artist_type == 'Axes':
return artist.transAxes
elif artist_type == 'Figure':
@@ -117,6 +119,7 @@ def xlabel(ax, label, x=None, y=-0.1, fontsize=20, transform=None, **kwargs):
if x is None:
x = 0.5
if transform is not None:
transform = get_trans_artist(transform)
x = (ax.transAxes + transform.inverted()).transform((x, 0))[0]
ax.xaxis.set_label_coords(x, y, transform=transform)
return ax.set_xlabel(label, fontsize=fontsize, **kwargs)
@@ -125,6 +128,7 @@ def ylabel(ax, label, x=-0.2, y=None, fontsize=20, transform=None, **kwargs):
if y is None:
y = 0.5
if transform is not None:
transform = get_trans_artist(transform)
y = (ax.transAxes + transform.inverted()).transform((0, y))[1]
ax.yaxis.set_label_coords(x, y, transform=transform)
return ax.set_ylabel(label, fontsize=fontsize, **kwargs)