Lots of stuff. Syncing to home.

This commit is contained in:
j-hartling
2026-03-20 16:45:54 +01:00
parent 1516fe6090
commit a276883454
28 changed files with 1106 additions and 562 deletions

View File

@@ -213,38 +213,45 @@ lw = dict(
space_kwargs = dict(
s=30,
)
xlabs = dict(
xlabels = dict(
spec='scale $\\alpha$',
big='$\\mu_{f_1}$'
)
ylabs = dict(
ylabels = dict(
spec='$\\mu_f$',
big='$\\mu_{f_2}$',
bar='scale $\\alpha$',
)
xlab_spec_kwargs = dict(
y=0.005,
y=0,
fontsize=16,
ha='center',
va='bottom',
)
xlab_big_kwargs = dict(
y=0,
fontsize=20,
ha='center',
va='bottom',
)
ylab_spec_kwargs = dict(
x=0,
fontsize=20,
ha='left',
va='center',
)
xlab_big_kwargs = dict(
y=0.005,
fontsize=20,
ha='center',
va='bottom',
)
ylab_big_kwargs = dict(
x=0.03,
fontsize=20,
ha='center',
va='center',
)
ylab_cbar_kwargs = dict(
x=1,
fontsize=16,
ha='center',
va='bottom',
)
xloc = dict(
big=0.5,
)
@@ -252,18 +259,18 @@ yloc = dict(
spec=0.5,
big=0.5
)
spec_letter_kwargs = dict(
letter_spec_kwargs = dict(
x=0,
y=1.03,
yref=1,
ha='center',
va='bottom',
va='top',
fontsize=22,
)
big_letter_kwargs = dict(
letter_big_kwargs = dict(
x=0,
yref=spec_letter_kwargs['y'],
yref=1,
ha='center',
va='bottom',
va='top',
fontsize=22,
)
time_bar_kwargs = dict(
@@ -274,7 +281,7 @@ time_bar_kwargs = dict(
lw=0
)
cbar_bounds = [
0.8,
0.05,
big_grid_kwargs['bottom'],
0.15,
big_grid_kwargs['top'] - big_grid_kwargs['bottom']
@@ -297,11 +304,11 @@ for i, j in product(range(spec_grid_kwargs['nrows']), range(n_species)):
ax.yaxis.set_major_locator(plt.MultipleLocator(yloc['spec']))
ax.set_ylim(0, 1)
spec_axes[i, j] = ax
super_xlabel(xlabs['spec'], spec_subfig, spec_axes[-1, 0], spec_axes[-1, -1], **xlab_spec_kwargs)
super_ylabel(ylabs['spec'], spec_subfig, spec_axes[-1, 0], spec_axes[0, 0], **ylab_spec_kwargs)
super_xlabel(xlabels['spec'], spec_subfig, spec_axes[-1, 0], spec_axes[-1, -1], **xlab_spec_kwargs)
super_ylabel(ylabels['spec'], spec_subfig, spec_axes[-1, 0], spec_axes[0, 0], **ylab_spec_kwargs)
[hide_ticks(ax, side='bottom') for ax in spec_axes[0, :]]
[hide_ticks(ax, side='left') for ax in spec_axes[:, 1:].ravel()]
letter_subplots(spec_axes[0, :], labels='abc', **spec_letter_kwargs)
letter_subplots(spec_axes[0, :], labels='abc', ref=spec_subfig, **letter_spec_kwargs)
# Prepare kernel insets:
x0 = np.linspace(0, 1, kernels.shape[0] + 1)[:-1] + 1 / kernels.shape[0] / 2
@@ -325,23 +332,17 @@ for i in range(big_axes.size):
ax.xaxis.set_major_locator(plt.MultipleLocator(xloc['big']))
ax.yaxis.set_major_locator(plt.MultipleLocator(yloc['big']))
ax.set_aspect(**anchor_kwargs)
# ax.set_ylabel(ylabs['big'], **ylab_big_kwargs)
ylabel(ax, ylabs['big'], transform=big_subfig.transSubfigure, **ylab_big_kwargs)
# ax.set_ylabel(ylabels['big'], **ylab_big_kwargs)
ylabel(ax, ylabels['big'], transform=big_subfig.transSubfigure, **ylab_big_kwargs)
big_axes[i] = ax
super_xlabel(xlabs['big'], big_subfig, big_axes[1], big_axes[1], **xlab_big_kwargs)
super_xlabel(xlabels['big'], big_subfig, big_axes[1], big_axes[1], **xlab_big_kwargs)
hide_ticks(big_axes[0], side='bottom')
letter_subplot(big_axes[0], 'd', ref=spec_axes[0, 0], **big_letter_kwargs)
letter_subplot(big_axes[0], 'd', ref=big_subfig, **letter_big_kwargs)
# Prepare colorbars:
bar_ax = big_subfig.add_axes(cbar_bounds)
bar_axes = split_subplot(bar_ax, side=['right', 'right'], size=100, pad=0)
bar_axes = [bar_ax] + bar_axes
for ax in bar_axes:
ax.spines[['right', 'top']].set_visible(True)
hide_ticks(ax, 'bottom', ticks=False)
hide_ticks(ax, 'left', ticks=False)
bar_axes[-1].tick_params(axis='y', which='both', right=True, labelright=True)
# plt.show()
cbar_bounds[0] += big_axes[-1].get_position().x1
bar_axes = [big_subfig.add_axes(cbar_bounds)]
bar_axes.extend(split_subplot(bar_axes[0], side=['right', 'right'], size=100, pad=0))
# Plot results per species:
for i, pure_path in enumerate(pure_paths):
@@ -377,10 +378,6 @@ for i, pure_path in enumerate(pure_paths):
inset.set_ylim(ylims)
time_bar(insets[0], parent=spec_axes[0, 0], **time_bar_kwargs)
# Prepare shaded colors:
# factors = np.linspace(*shade_factors, scales.size)
# shaded_colors = shade_colors(spec_colors[i], factors)
# Plot pure feature space:
handle = big_axes[0].scatter(pure_measure[:, 0], pure_measure[:, 1],
c=scales, cmap=spec_cmaps[i], **space_kwargs)
@@ -391,6 +388,11 @@ for i, pure_path in enumerate(pure_paths):
# Indicate scale color code:
big_subfig.colorbar(handle, cax=bar_axes[i])
bar_axes[i].set_yscale('symlog', linthresh=scales[1], linscale=0.2)
if i < len(pure_paths) - 1:
hide_ticks(bar_axes[i], 'right', ticks=False)
else:
ylabel(bar_axes[i], ylabels['bar'], transform=big_subfig.transSubfigure, **ylab_cbar_kwargs)
if save_path is not None:
fig.savefig(save_path)