Captioned appendix figures.
Polished some figures. Shortened existing figure captions.
This commit is contained in:
@@ -13,9 +13,9 @@ from IPython import embed
|
||||
|
||||
# GENERAL SETTINGS:
|
||||
target_species = [
|
||||
# 'Chorthippus_biguttulus',
|
||||
# 'Chorthippus_mollis',
|
||||
# 'Chrysochraon_dispar',
|
||||
'Chorthippus_biguttulus',
|
||||
'Chorthippus_mollis',
|
||||
'Chrysochraon_dispar',
|
||||
# 'Euchorthippus_declivus',
|
||||
'Gomphocerippus_rufus',
|
||||
'Omocestus_rufipes',
|
||||
@@ -35,7 +35,15 @@ save_path = '../figures/fig_invariance_cross_species_thresh_appendix.pdf'
|
||||
|
||||
# ANALYSIS SETTINGS:
|
||||
exclude_zero = True
|
||||
thresh_rel = np.array([0, 0.5, 1, 1.5, 2, 2.5, 3])
|
||||
thresh_rel = np.array([
|
||||
# 0,
|
||||
0.5,
|
||||
1,
|
||||
# 1.5,
|
||||
2,
|
||||
# 2.5,
|
||||
3,
|
||||
])
|
||||
|
||||
# SUBSET SETTINGS:
|
||||
types = np.array([1, -1, 2, -2, 3, -3, 4, -4])
|
||||
@@ -53,15 +61,15 @@ fig_kwargs = dict(
|
||||
sharex=True,
|
||||
sharey=True,
|
||||
gridspec_kw=dict(
|
||||
wspace=0.2,
|
||||
hspace=0.75,
|
||||
wspace=0.3,
|
||||
hspace=0.5,
|
||||
left=0.1,
|
||||
right=0.95,
|
||||
bottom=0.08,
|
||||
right=0.97,
|
||||
bottom=0.1,
|
||||
top=0.98,
|
||||
)
|
||||
)
|
||||
inset_x_bounds = [0, -0.5, 1, 0.4]
|
||||
inset_x_bounds = [0, -0.3, 1, 0.25]
|
||||
inset_y_bounds = [1.01, 0, 0.1, 1]
|
||||
|
||||
# PLOT SETTINGS:
|
||||
@@ -162,6 +170,7 @@ y_dist_kwargs = dict(
|
||||
fig, axes = plt.subplots(**fig_kwargs)
|
||||
axes[0, 0].set_ylim(0, 1)
|
||||
axes[0, 0].yaxis.set_major_locator(plt.MultipleLocator(yloc))
|
||||
axes[0, 0].xaxis.set_major_locator(plt.LogLocator(base=10, subs=(1,)))
|
||||
super_xlabel(xlab, fig, axes[-1, 0], axes[-1, -1], **xlab_kwargs)
|
||||
super_ylabel(ylab, fig, axes[0, 0], axes[-1, 0], **ylab_super_kwargs)
|
||||
for ax, species in zip(axes[0, :], target_species):
|
||||
@@ -197,25 +206,27 @@ for i, species in enumerate(target_species):
|
||||
symlog_kwargs = dict(linthresh=scales[scales > 0][0], linscale=0.5)
|
||||
|
||||
# Run through thresholds:
|
||||
for j in range(thresh_rel.size):
|
||||
for j, thresh in enumerate(thresh_rel):
|
||||
ax = axes[j, i]
|
||||
ind = np.nonzero(data['thresh_rel'] == thresh)[0][0]
|
||||
|
||||
# Plot swarm of feature-specific intensity curves:
|
||||
handles = ax.plot(scales, measure[:, :, j], lw=lw['swarm'])
|
||||
handles = ax.plot(scales, measure[:, :, ind], lw=lw['swarm'])
|
||||
assign_colors(handles, config['k_specs'][:, 0], kern_colors)
|
||||
reorder_by_sd(handles, measure[:, :, j])
|
||||
reorder_by_sd(handles, measure[:, :, ind])
|
||||
|
||||
# Plot single compressed intensity curve:
|
||||
compressed = np.median(measure[:, :, j], axis=1)
|
||||
compressed = np.median(measure[:, :, ind], axis=1)
|
||||
ax.plot(scales, compressed, **median_kwargs)
|
||||
|
||||
# Plot distribution of saturation levels:
|
||||
inset = ax.inset_axes(inset_y_bounds)
|
||||
inset.set_ylim(0, 1)
|
||||
inset.axis('off')
|
||||
y_dist(inset, measure[-1, :, j], **y_dist_kwargs)
|
||||
y_dist(inset, measure[-1, :, ind], **y_dist_kwargs)
|
||||
|
||||
# Plot distribution of saturation points:
|
||||
crit_inds = np.array(get_saturation(measure[:, :, j], **plateau_settings)[1])
|
||||
crit_inds = np.array(get_saturation(measure[:, :, ind], **plateau_settings)[1])
|
||||
if np.isnan(crit_inds).sum():
|
||||
print(f'WARNING: No saturation points found for {species} at threshold {thresh_rel[j]}')
|
||||
crit_inds = crit_inds[~np.isnan(crit_inds)].astype(int)
|
||||
@@ -223,12 +234,13 @@ for i, species in enumerate(target_species):
|
||||
inset = ax.inset_axes(inset_x_bounds)
|
||||
inset.set_xlim(scales[0], scales[-1])
|
||||
inset.set_xscale('symlog', **symlog_kwargs)
|
||||
inset.xaxis.set_major_locator(plt.LogLocator(base=10, subs=(1,)))
|
||||
hide_axis(inset, 'left')
|
||||
if j < thresh_rel.size - 1:
|
||||
hide_ticks(inset, 'bottom')
|
||||
x_dist(inset, crit_scales, **x_dist_kwargs)
|
||||
|
||||
if j > 0:
|
||||
if thresh > 0:
|
||||
# Plot single saturation point:
|
||||
crit_ind = get_saturation(compressed, **plateau_settings)[1]
|
||||
crit_scale = scales[crit_ind]
|
||||
@@ -237,6 +249,7 @@ for i, species in enumerate(target_species):
|
||||
# Posthocs:
|
||||
axes[0, 0].set_xscale('symlog', **symlog_kwargs)
|
||||
axes[0, 0].set_xlim(scales[0], scales[-1])
|
||||
axes[0, 0].xaxis.set_major_locator(plt.LogLocator(base=10, subs=(1,)))
|
||||
|
||||
if save_path is not None:
|
||||
fig.savefig(save_path)
|
||||
|
||||
Reference in New Issue
Block a user