|
@@ -7,6 +7,7 @@ import matplotlib.image as mpimg
|
|
|
|
|
|
from .figure_style import subfig_labelsize, subfig_labelweight, despine
|
|
|
|
|
|
+plt.style.use("./code/plots/pnas_onecolumn.mplstyle")
|
|
|
|
|
|
def plot_info_errorbar(axis, pop_size, info, label="", ls="-", color="tab:blue"):
|
|
|
info_mean = np.mean(info, axis=1)
|
|
@@ -32,27 +33,30 @@ def plot_info_per_band(ax1, ax2, ax3, population_size, info_no_delay, info1_dela
|
|
|
plot_info_errorbar(ax3, population_size, info3_delay, label=labels[3], ls=ls, color=colors[3])
|
|
|
|
|
|
|
|
|
-def pimp_lif_sim_axes(axis, set_ylabel=True):
|
|
|
+def pimp_lif_sim_axes(axis, set_ylabel=True, set_xlabel=True):
|
|
|
despine(axis, ["top", "right"], False)
|
|
|
|
|
|
axis.set_xlim([0, 210])
|
|
|
axis.set_xticks(np.arange(0, 201, 100))
|
|
|
axis.set_xticks(np.arange(0, 201, 50), minor=True)
|
|
|
axis.set_xticklabels(np.arange(0, 201, 100))
|
|
|
- axis.set_xlabel("population size", labelpad=1.5)
|
|
|
+ if set_xlabel:
|
|
|
+ axis.set_xlabel("population size", labelpad=1.5)
|
|
|
|
|
|
axis.set_ylim([0, 750])
|
|
|
axis.set_yticks(np.arange(0, 801, 200))
|
|
|
axis.set_yticks(np.arange(0, 801, 100), minor=True)
|
|
|
if set_ylabel:
|
|
|
axis.set_ylabel("mutual information [bits/s]")
|
|
|
-
|
|
|
- axis.legend(frameon=True, fontsize=5, loc=2)
|
|
|
+ else:
|
|
|
+ axis.set_yticklabels([])
|
|
|
+ if set_xlabel:
|
|
|
+ axis.legend(bbox_to_anchor=(0.3, -1.075, 2.1, 0.25), ncol=2, frameon=True)
|
|
|
|
|
|
|
|
|
-def add_additional_xaxes(fig, axis, population_size, density, conduction_velocity, delay_dx=1):
|
|
|
+def add_additional_xaxes(fig, axis, population_size, density, conduction_velocity, delay_dx=1, add_label=True):
|
|
|
pos = axis.get_position().bounds
|
|
|
- ax2 = fig.add_axes((pos[0], 0.2, pos[2], 0.0))
|
|
|
+ ax2 = fig.add_axes((pos[0], 0.325, pos[2], 0.0))
|
|
|
ax2.yaxis.set_visible(False) # hide the yaxis
|
|
|
max_rf = max(population_size) / density * 1000
|
|
|
rf_ticklabels = np.arange(0, np.ceil(max_rf)+1, np.ceil(max_rf/2), dtype=int)
|
|
@@ -62,21 +66,23 @@ def add_additional_xaxes(fig, axis, population_size, density, conduction_velocit
|
|
|
ax2.set_xticks(rf_ticks)
|
|
|
ax2.set_xticklabels(rf_ticklabels)
|
|
|
ax2.set_xticks(rf_minorticks, minor=True)
|
|
|
- ax2.set_xlabel("receptive field size [mm]", labelpad=1.52)
|
|
|
+ if add_label:
|
|
|
+ ax2.set_xlabel("receptive field size [mm]", labelpad=1.52)
|
|
|
ax2.set_xlim([0, 210])
|
|
|
|
|
|
pos = axis.get_position().bounds
|
|
|
- ax3 = fig.add_axes((pos[0], 0.11, pos[2], 0.0))
|
|
|
+ ax3 = fig.add_axes((pos[0], 0.2, pos[2], 0.0))
|
|
|
ax3.yaxis.set_visible(False) # hide the yaxis
|
|
|
max_delay = np.ceil(max(population_size) / density / conduction_velocity * 1000)
|
|
|
- delay_xticklabels = np.arange(0.0, max_delay+delay_dx, delay_dx)
|
|
|
+ delay_xticklabels = np.arange(0, max_delay+delay_dx, delay_dx, dtype=int)
|
|
|
delay_xticks = delay_xticklabels /1000 * conduction_velocity * density
|
|
|
minor_delay_xticklabels = np.arange(0.0, max_delay+1, delay_dx/5)
|
|
|
minor_delay_xticks = minor_delay_xticklabels / 1000 * conduction_velocity * density
|
|
|
ax3.set_xticks(delay_xticks)
|
|
|
ax3.set_xticklabels(delay_xticklabels)
|
|
|
ax3.set_xticks(minor_delay_xticks, minor=True)
|
|
|
- ax3.set_xlabel("maximum delay [ms]", labelpad=1.5)
|
|
|
+ if add_label:
|
|
|
+ ax3.set_xlabel("maximum delay [ms]", labelpad=1.5)
|
|
|
ax3.set_xlim([0, 210])
|
|
|
|
|
|
|
|
@@ -101,28 +107,28 @@ def add_model_sketches(fig):
|
|
|
|
|
|
|
|
|
def layout_figure(titles, colors):
|
|
|
- fig = plt.figure(figsize=(7, 5))
|
|
|
+ fig = plt.figure(figsize=(3.42, 3.5))#, constrained_layout=True)
|
|
|
axes = []
|
|
|
|
|
|
fig_grid = (8, 8)
|
|
|
colors = ["tab:blue", "tab:red", "tab:orange", "tab:green"]
|
|
|
# low velocity
|
|
|
- axes.append(plt.subplot2grid(fig_grid, (3, 0), 4, 2))
|
|
|
+ axes.append(plt.subplot2grid(fig_grid, (0, 0), 4, 2))
|
|
|
# squid velocity
|
|
|
- axes.append(plt.subplot2grid(fig_grid, (3, 3), 4, 2))
|
|
|
+ axes.append(plt.subplot2grid(fig_grid, (0, 3), 4, 2))
|
|
|
# efish velocity
|
|
|
- axes.append(plt.subplot2grid(fig_grid, (3, 6), 4, 2))
|
|
|
+ axes.append(plt.subplot2grid(fig_grid, (0, 6), 4, 2))
|
|
|
|
|
|
- axes[0].text(0.5, 1.05, titles[0], transform=axes[0].transAxes, ha="center",fontsize=6, color=colors[1])
|
|
|
- axes[0].text(-0.5, 1.95, "A", transform=axes[0].transAxes, fontsize=subfig_labelsize, weight=subfig_labelweight, color="k")
|
|
|
- axes[1].text(0.5, 1.05, titles[1], transform=axes[1].transAxes, ha="center",fontsize=6, color=colors[2])
|
|
|
- axes[1].text(-0.5, 1.95, "B", transform=axes[1].transAxes, fontsize=subfig_labelsize, weight=subfig_labelweight)
|
|
|
- axes[2].text(0.5, 1.05, titles[2], transform=axes[2].transAxes, ha="center", fontsize=6, color=colors[3])
|
|
|
- axes[2].text(-0.5, 1.95, "C", transform=axes[2].transAxes,fontsize=subfig_labelsize, weight=subfig_labelweight)
|
|
|
+ axes[0].text(0.5, 0.95, titles[0], transform=axes[0].transAxes, ha="center",fontsize=8, color=colors[1])
|
|
|
+ axes[0].text(-0.5, 1.1, "A", transform=axes[0].transAxes, fontsize=subfig_labelsize, weight=subfig_labelweight, color="k")
|
|
|
+ axes[1].text(0.5, 0.95, titles[1], transform=axes[1].transAxes, ha="center",fontsize=8, color=colors[2])
|
|
|
+ axes[1].text(-0.35, 1.1, "B", transform=axes[1].transAxes, fontsize=subfig_labelsize, weight=subfig_labelweight)
|
|
|
+ axes[2].text(0.5, 0.95, titles[2], transform=axes[2].transAxes, ha="center", fontsize=8, color=colors[3])
|
|
|
+ axes[2].text(-0.35, 1.1, "C", transform=axes[2].transAxes,fontsize=subfig_labelsize, weight=subfig_labelweight)
|
|
|
|
|
|
- fig.subplots_adjust(left=0.10, bottom=0.20, top=0.90, right=0.95, hspace=0.02)
|
|
|
+ fig.subplots_adjust(left=0.15, bottom=0.0, top=0.9, right=0.975, wspace=-0.2)
|
|
|
|
|
|
- add_model_sketches(fig)
|
|
|
+ #add_model_sketches(fig)
|
|
|
return fig, axes
|
|
|
|
|
|
|
|
@@ -136,10 +142,10 @@ def lif_simulations(args):
|
|
|
titles = [r"%.1f$m/s$" % 7.0,
|
|
|
r"%.1f$m/s$" % 25.,
|
|
|
r"%.1f$m/s$ " % 50.]
|
|
|
- labels = ["w/o delay; 0 - 100 Hz",
|
|
|
- "w delay; 0 - 100 Hz",
|
|
|
- "w delay; 100 - 200 Hz",
|
|
|
- "w delay; 200 - 300 Hz"]
|
|
|
+ labels = ["without delay; 0 - 100 Hz",
|
|
|
+ "with delay; 0 - 100 Hz",
|
|
|
+ "with delay; 100 - 200 Hz",
|
|
|
+ "with delay; 200 - 300 Hz"]
|
|
|
line_styles = ["--", "-.", ":"]
|
|
|
colors = ["tab:blue", "tab:red", "tab:orange", "tab:green"]
|
|
|
|
|
@@ -165,11 +171,11 @@ def lif_simulations(args):
|
|
|
plot_info_per_band(axes[0], axes[1], axes[2], pop_size, None, info_slow, info_squid, info_efish, colors=colors, ls=line_styles[i], labels=lbls)
|
|
|
|
|
|
for i, a in enumerate(axes):
|
|
|
- pimp_lif_sim_axes(a, i == 0)
|
|
|
+ pimp_lif_sim_axes(a, i == 0, i==1)
|
|
|
|
|
|
- add_additional_xaxes(fig, axes[0], pop_size, density, vel_low, 5)
|
|
|
- add_additional_xaxes(fig, axes[1], pop_size, density, vel_med, 1.0)
|
|
|
- add_additional_xaxes(fig, axes[2], pop_size, density, vel_high, .5)
|
|
|
+ add_additional_xaxes(fig, axes[0], pop_size, density, vel_low, 5, add_label=False)
|
|
|
+ add_additional_xaxes(fig, axes[1], pop_size, density, vel_med, 2.0)
|
|
|
+ add_additional_xaxes(fig, axes[2], pop_size, density, vel_high, 1.0, add_label=False)
|
|
|
|
|
|
if args.nosave:
|
|
|
plt.show()
|