updated figures based on discussion

This commit is contained in:
nkoch1
2022-05-21 00:18:33 -04:00
parent 493ed7b1e7
commit 6c28f34dc0
12 changed files with 199 additions and 76 deletions

Binary file not shown.

View File

@@ -305,20 +305,24 @@ def plot_AUC_alt(ax, model='FS', color1='red', color2='dodgerblue', alteration='
ax.set_xticks([0.5, 1, 2])
ax.xaxis.set_major_formatter(ticker.ScalarFormatter())
ax.xaxis.set_minor_formatter(NullFormatter())
ax.set_xlabel('Slope factor k')
ax.set_xlabel('$k$/$k_{WT}$')
elif alteration=='g':
df = pd.read_csv('./Figures/Data/AUC_g_ex.csv')
ax.set_xscale("log")
ax.set_xticks([0.5, 1, 2])
ax.xaxis.set_major_formatter(ticker.ScalarFormatter())
ax.xaxis.set_minor_formatter(NullFormatter())
ax.set_xlabel('g')
ax.set_xlabel('$g$/$g_{WT}$')
for mod in model_names:
if mod == model_name_dict[model]:
ax.plot(df['alteration'], df[mod], color=clr_dict[mod], alpha=1, zorder=10, linewidth=2)
else:
ax.plot(df['alteration'], df[mod], color=clr_dict[mod],alpha=1, zorder=1, linewidth=1)
ax.set_ylabel('Normalized AUC')
if alteration=='shift':
ax.set_ylabel('Normalized $\Delta$AUC', labelpad=4)
else:
ax.set_ylabel('Normalized $\Delta$AUC', labelpad=0)
x = df['alteration']
y = df[model_name_dict[model]]
ax.set_xlim(x.min(), x.max())
@@ -382,23 +386,23 @@ color_dict = {'Cb stellate': '#40A787', # cyan'#
# plot setup
marker_s_leg = 2
max_width = 20
pad_x = 0.8
pad_y= 0.45
pad_w = 1
pad_x = 0.85
pad_y= 0.4
pad_w = 1.1
pad_h = 0.7
fig = plt.figure()
# fig = plt.figure()
# fig.set_size_inches(cm2inch(17.6,10))
gs = fig.add_gridspec(3, 6, wspace=1.2, hspace=1.)
gs = fig.add_gridspec(3, 7, wspace=1.2, hspace=1.)
# plt.subplots_adjust(hspace=0.8) #, wspace=0.6
ax0 = fig.add_subplot(gs[0,2:6])
ax0 = fig.add_subplot(gs[0,2:7])
ax0_ex = fig.add_subplot(gs[0,1])
ax0_fI = fig.add_subplot(gs[0,0])
ax1 = fig.add_subplot(gs[1,2:6])
ax1 = fig.add_subplot(gs[1,2:7])
ax1_ex = fig.add_subplot(gs[1,1])
ax1_fI = fig.add_subplot(gs[1,0])
ax2 = fig.add_subplot(gs[2,2:6])
ax2 = fig.add_subplot(gs[2,2:7])
ax2_ex = fig.add_subplot(gs[2,1])
ax2_fI = fig.add_subplot(gs[2,0])
@@ -419,10 +423,8 @@ rec = plt.Rectangle((-pad_x, -pad_y), 1 + pad_w, 1 + pad_h, fill=False, lw=line
rec = ax2_fI.add_patch(rec)
rec.set_clip_on(False)
# label subplots with letters
ax0_fI.text(-0.825, 1.3, string.ascii_uppercase[0], transform=ax0_fI.transAxes, size=10, weight='bold') #-0.09
ax1_fI.text(-0.825, 1.3, string.ascii_uppercase[1], transform=ax1_fI.transAxes,size=10, weight='bold')
ax2_fI.text(-0.825, 1.3, string.ascii_uppercase[2], transform=ax2_fI.transAxes,size=10, weight='bold')
# plot boxplots
boxplot_with_markers(ax0,max_width, alteration='shift')
@@ -430,7 +432,7 @@ boxplot_with_markers(ax1,max_width, alteration='slope')
boxplot_with_markers(ax2,max_width, alteration='g')
# plot legend
pos = (0.15, -0.9)
pos = (0.225, -0.9)
ncol = 5
model_legend(ax2, marker_s_leg, pos, ncol)
@@ -439,10 +441,23 @@ plot_AUC_alt(ax0_ex,model='FS +$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$', color1='l
plot_AUC_alt(ax1_ex,model='FS +$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$', color1='lightgrey', color2='k',alteration='slope')
plot_AUC_alt(ax2_ex, model='STN +$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$', color1='lightgrey', color2='k', alteration='g')
# label subplots with letters
ax0_fI.text(-0.875, 1.35, string.ascii_uppercase[0], transform=ax0_fI.transAxes, size=10, weight='bold')
ax0_ex.text(-0.8, 1.35, string.ascii_uppercase[1], transform=ax0_ex.transAxes, size=10, weight='bold')
ax0.text(-0.075, 1.35, string.ascii_uppercase[2], transform=ax0.transAxes, size=10, weight='bold')
ax1_fI.text(-0.875, 1.35, string.ascii_uppercase[3], transform=ax1_fI.transAxes,size=10, weight='bold')
ax1_ex.text(-0.8, 1.35, string.ascii_uppercase[4], transform=ax1_ex.transAxes, size=10, weight='bold')
ax1.text(-0.075, 1.35, string.ascii_uppercase[5], transform=ax1.transAxes, size=10, weight='bold')
ax2_fI.text(-0.875, 1.35, string.ascii_uppercase[6], transform=ax2_fI.transAxes,size=10, weight='bold')
ax2_ex.text(-0.8, 1.35, string.ascii_uppercase[7], transform=ax2_ex.transAxes, size=10, weight='bold')
ax2.text(-0.075, 1.35, string.ascii_uppercase[8], transform=ax2.transAxes, size=10, weight='bold')
#save
# plt.tight_layout(pad=0)
print(fig.dpi)
fig.set_size_inches(cm2inch(20.6,12))
fig.set_size_inches(cm2inch(20.75,12))
fig.savefig('./Figures/AUC_correlation.pdf', dpi=fig.dpi) #bbox_inches='tight', dpi=fig.dpi
plt.show()

Binary file not shown.

View File

@@ -223,6 +223,7 @@ def plot_diff_sqrt(ax, a=1, b=0.2, c=100, d=0, a2=1, b2=0.2, c2=100, d2=0):
ax.set_xticks([])
ax.set_yticks([])
def plot_quadrant(ax):
ax.spines['left'].set_position('zero')
ax.spines['bottom'].set_position('zero')
@@ -250,7 +251,7 @@ def plot_quadrant(ax):
scheme_style()
#%% with legend
fig = plt.figure(figsize=cm2inch(7, 12))
gs = gridspec.GridSpec(3,6, top=0.95, bottom=0.1, left=0.15, right = 0.95, hspace=0.8, wspace=0.6)
ax1 = fig.add_subplot(gs[0,1:])
@@ -281,24 +282,105 @@ ax3.text(-0.95, 0.35, 'GOF', ha='right')
ax3_TL = ax3.inset_axes([0.07, 0.6, 0.3, 0.2])
plot_diff_sqrt(ax3_TL, b2=0.1, c2=200)
ax3_TL.set_ylim(inset_ylim)
# top right
ax3.text(x=0.22, y=0.7, s='$\\uparrow$ AUC\n$\\uparrow$ rheobase', fontsize=lfsize)
ax3.text(0.95, 0.35, 'LOF/\nGOF?')
ax3_TR = ax3.inset_axes([0.63, 0.6, 0.3, 0.2])
plot_diff_sqrt(ax3_TR, b2=0.4, c2=200)
ax3_TR.set_ylim(inset_ylim)
# bottom left
ax3.text(x=-0.9, y=-0.95, s='$\\downarrow$ AUC\n$\downarrow$ rheobase', fontsize=lfsize)
ax3.text(-0.95, -0.55, 'GOF/\nLOF?', ha='right')
ax3_BL = ax3.inset_axes([0.07, 0.15, 0.3, 0.2])
plot_diff_sqrt(ax3_BL, b2=0.1, c2=75)
plot_diff_sqrt(ax3_BL, b2=0.07, c2=65)
ax3_BL.set_ylim(inset_ylim)
# bottom right
ax3.text(x=0.22, y=-0.95, s='$\\downarrow$ AUC\n$\\uparrow$ rheobase', fontsize=lfsize)
ax3.text(0.95, -0.55, 'LOF')
ax3_BR = ax3.inset_axes([0.63, 0.15, 0.3, 0.2])
plot_diff_sqrt(ax3_BR, b2=0.4, c2=75)
plot_diff_sqrt(ax3_BR, b2=0.4, c2=60)
ax3_BR.set_ylim(inset_ylim)
import matplotlib.lines as mlines
wt = mlines.Line2D([], [], color=colorslist[9], linestyle='-',label='WT')
mut = mlines.Line2D([], [], color=colorslist[2], linestyle='-',label='Altered')
pos = (0.575, 0.05)
ncol = 2
fig.legend(handles=[wt, mut], loc='center', bbox_to_anchor=pos, ncol=ncol, frameon=False, fontsize=8)
fig.set_size_inches(cm2inch(8.5,12))
fig.savefig('./Figures/firing_characterization.pdf', dpi=fig.dpi) #bbox_inches='tight', dpi=fig.dpi
plt.show()
#%% with arrows
fig = plt.figure(figsize=cm2inch(7, 12))
gs = gridspec.GridSpec(3,6, top=0.95, bottom=0.1, left=0.15, right = 0.95, hspace=0.8, wspace=0.6)
ax1 = fig.add_subplot(gs[0,1:])
show_spines(ax1, 'lb')
plot_AUC(ax1, width=0.2)
ax3 = fig.add_subplot(gs[1:, :])
# add panel letter labels
# ax_list = fig.axes
# i =0
# for a in ax_list:
# a.text(-0.25, 1.08, string.ascii_uppercase[i], transform=a.transAxes,size=16, weight='bold')
# i += 1
ax1.text(-0.4, 1.2, string.ascii_uppercase[0], transform=ax1.transAxes, size=16, weight='bold')
ax3.text(-0.15, 1.05, string.ascii_uppercase[1], transform=ax3.transAxes, size=16, weight='bold')
show_spines(ax3, '')
#ax3.set_ylabel('$\\Delta$ AUC', rotation='vertical')
#ax3.set_xlabel('$\\Delta$ rheobase')
plot_quadrant(ax3) # plot delineation into quadrants
inset_ylim = (0, 100)
# top left
lfsize = 8
ax3.text(x=-0.9, y=0.7, s='$\\uparrow$ AUC\n$\\downarrow$ rheobase', fontsize=lfsize)
ax3.text(-0.95, 0.35, 'GOF', ha='right')
ax3_TL = ax3.inset_axes([0.07, 0.6, 0.3, 0.2])
plot_diff_sqrt(ax3_TL, b2=0.1, c2=200)
ax3_TL.set_ylim(inset_ylim)
ax3_TL.annotate('', (0.25, 15), (0.1, 27), arrowprops=dict(arrowstyle="<|-", color=colorslist[2],lw=0.5, mutation_scale=5), zorder=-10) #
ax3_TL.annotate('', (0.55, 55), (0.3, 90), arrowprops=dict(arrowstyle="<|-", color=colorslist[2],lw=0.5, mutation_scale=5), zorder=-10) #
# top right
ax3.text(x=0.22, y=0.7, s='$\\uparrow$ AUC\n$\\uparrow$ rheobase', fontsize=lfsize)
ax3.text(0.95, 0.35, 'LOF/\nGOF?')
ax3_TR = ax3.inset_axes([0.63, 0.6, 0.3, 0.2])
plot_diff_sqrt(ax3_TR, b2=0.4, c2=200)
ax3_TR.set_ylim(inset_ylim)
ax3_TR.annotate('', (0.2, 15), (0.41, 15), arrowprops=dict(arrowstyle="<|-", color=colorslist[2],lw=0.5, mutation_scale=5), zorder=-10) #
ax3_TR.annotate('', (0.8, 70), (0.6, 90), arrowprops=dict(arrowstyle="<|-", color=colorslist[2],lw=0.5, mutation_scale=5), zorder=-10) #
# bottom left
ax3.text(x=-0.9, y=-0.95, s='$\\downarrow$ AUC\n$\downarrow$ rheobase', fontsize=lfsize)
ax3.text(-0.95, -0.55, 'GOF/\nLOF?', ha='right')
ax3_BL = ax3.inset_axes([0.07, 0.15, 0.3, 0.2])
plot_diff_sqrt(ax3_BL, b2=0.07, c2=65)
ax3_BL.set_ylim(inset_ylim)
ax3_BL.annotate('', (0.25, 5), (0.07, 5), arrowprops=dict(arrowstyle="<|-", color=colorslist[2],lw=0.5, mutation_scale=5), zorder=-10) #
ax3_BL.annotate('', (0.8, 80), (0.85, 55), arrowprops=dict(arrowstyle="<|-", color=colorslist[2],lw=0.5, mutation_scale=5), zorder=-10) #
# bottom right
ax3.text(x=0.22, y=-0.95, s='$\\downarrow$ AUC\n$\\uparrow$ rheobase', fontsize=lfsize)
ax3.text(0.95, -0.55, 'LOF')
ax3_BR = ax3.inset_axes([0.63, 0.15, 0.3, 0.2])
plot_diff_sqrt(ax3_BR, b2=0.4, c2=60)
ax3_BR.set_ylim(inset_ylim)
ax3_BR.annotate('', (0.2, 15), (0.425, 10), arrowprops=dict(arrowstyle="<|-", color=colorslist[2],lw=0.5, mutation_scale=5), zorder=-10) #
ax3_BR.annotate('', (0.65, 75), (0.8, 37.5), arrowprops=dict(arrowstyle="<|-", color=colorslist[2],lw=0.5, mutation_scale=5), zorder=-10) #
fig.set_size_inches(cm2inch(8.5,12))
fig.savefig('./Figures/firing_characterization_arrows.pdf', dpi=fig.dpi) #bbox_inches='tight', dpi=fig.dpi
plt.show()

Binary file not shown.

View File

@@ -49,11 +49,11 @@ def sim_style():
plt.rcParams['xtick.direction'] = 'out'
plt.rcParams['ytick.direction'] = 'out'
plt.rcParams['axes.titlesize'] = 6
plt.rcParams['axes.labelsize'] = 4
plt.rcParams['axes.labelsize'] = 8
plt.rcParams['lines.linewidth'] = 1
plt.rcParams['lines.markersize'] = 4
plt.rcParams['xtick.labelsize'] = 4
plt.rcParams['ytick.labelsize'] = 4
plt.rcParams['xtick.labelsize'] = 6
plt.rcParams['ytick.labelsize'] = 6
plt.rcParams['savefig.bbox'] = 'tight'
plt.rcParams.update({'font.size': 4})
plt.rcParams.update({'font.size': 6})
plt.rcParams['figure.dpi'] = 300

Binary file not shown.

Binary file not shown.

View File

@@ -288,14 +288,14 @@ def plot_rheo_alt(ax, model='FS', color1='red', color2='dodgerblue', alteration=
ax.set_xticks([0.5, 1, 2])
ax.xaxis.set_major_formatter(ticker.ScalarFormatter())
ax.xaxis.set_minor_formatter(NullFormatter())
ax.set_xlabel('Slope factor k')
ax.set_xlabel('$k$/$k_{WT}$')
elif alteration=='g':
df = pd.read_csv('./Figures/Data/rheo_g_ex.csv')
ax.set_xscale("log")
ax.set_xticks([0.5, 1, 2])
ax.xaxis.set_major_formatter(ticker.ScalarFormatter())
ax.xaxis.set_minor_formatter(NullFormatter())
ax.set_xlabel('g')
ax.set_xlabel('$g$/$g_{WT}$')
for mod in model_names:
if mod == model_name_dict[model]:
ax.plot(df['alteration'], df[mod], color=clr_dict[mod], alpha=1, zorder=10, linewidth=2)
@@ -403,10 +403,6 @@ rec = plt.Rectangle((-pad_x, -pad_y), 1 + pad_w, 1 + pad_h, fill=False, lw=line
rec = ax2_fI.add_patch(rec)
rec.set_clip_on(False)
# label fI subplots with letters
ax0_fI.text(-0.875, 1.35, string.ascii_uppercase[0], transform=ax0_fI.transAxes, size=10, weight='bold') #-0.09
ax1_fI.text(-0.875, 1.35, string.ascii_uppercase[1], transform=ax1_fI.transAxes,size=10, weight='bold')
ax2_fI.text(-0.875, 1.35, string.ascii_uppercase[2], transform=ax2_fI.transAxes,size=10, weight='bold')
# plot boxplots
boxplot_with_markers(ax0,max_width, alteration='shift')
@@ -423,6 +419,19 @@ plot_rheo_alt(ax0_ex,model='FS +$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$', color1='
plot_rheo_alt(ax1_ex,model='Cb stellate +$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$', color1='lightgrey', color2='k',alteration='slope')
plot_rheo_alt(ax2_ex, model='Cb stellate', color1='lightgrey', color2='k', alteration='g')
# label subplots with letters
ax0_fI.text(-0.875, 1.35, string.ascii_uppercase[0], transform=ax0_fI.transAxes, size=10, weight='bold')
ax0_ex.text(-0.8, 1.35, string.ascii_uppercase[1], transform=ax0_ex.transAxes, size=10, weight='bold')
ax0.text(-0.075, 1.35, string.ascii_uppercase[2], transform=ax0.transAxes, size=10, weight='bold')
ax1_fI.text(-0.875, 1.35, string.ascii_uppercase[3], transform=ax1_fI.transAxes,size=10, weight='bold')
ax1_ex.text(-0.8, 1.35, string.ascii_uppercase[4], transform=ax1_ex.transAxes, size=10, weight='bold')
ax1.text(-0.075, 1.35, string.ascii_uppercase[5], transform=ax1.transAxes, size=10, weight='bold')
ax2_fI.text(-0.875, 1.35, string.ascii_uppercase[6], transform=ax2_fI.transAxes,size=10, weight='bold')
ax2_ex.text(-0.8, 1.35, string.ascii_uppercase[7], transform=ax2_ex.transAxes, size=10, weight='bold')
ax2.text(-0.075, 1.35, string.ascii_uppercase[8], transform=ax2.transAxes, size=10, weight='bold')
# save
# fig.savefig('./Figures/rheobase_correlation.pdf', bbox_inches='tight')
print(fig.dpi)

View File

@@ -4,7 +4,7 @@ import pandas as pd
import os
import string
# from plotstyle import plot_style
from plotstyle import sim_style
from Figures.plotstyle import sim_style
import seaborn as sns
import scipy.stats as stats
import matplotlib.lines as mlines
@@ -28,7 +28,8 @@ def Kendall_tau(df):
return tau, p
def correlation_plot(ax, df='AUC', title='', cbar=False):
cbar_ax = fig.add_axes([0.94, .25, .03, .4])
# cbar_ax = fig.add_axes([0.94, .25, .03, .4])
cbar_ax = fig.add_axes([0.685, 0.44, .15, .01])
cbar_ax.spines['left'].set_visible(False)
cbar_ax.spines['bottom'].set_visible(False)
cbar_ax.spines['right'].set_visible(False)
@@ -61,7 +62,7 @@ def correlation_plot(ax, df='AUC', title='', cbar=False):
tau = tau.drop(columns='STN $\Delta$$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$', index='RS pyramidal')
# mask to hide upper triangle of matrix
mask = np.zeros_like(tau, dtype=np.bool)
mask = np.zeros_like(tau, dtype=bool)
mask[np.triu_indices_from(mask)] = True
np.fill_diagonal(mask, False)
@@ -88,11 +89,17 @@ def correlation_plot(ax, df='AUC', title='', cbar=False):
cbar=False, cmap=cmap, cbar_ax=cbar_ax, cbar_kws={"shrink": .52})
else:
res = sns.heatmap(tau, annot=False, mask=mask, center=0, vmax=1, vmin=-1, linewidths=.5, square=True, ax=ax,
cbar=True, cmap=cmap, cbar_ax=cbar_ax, )
cbar_ax.set_title(r'Kendall $\tau$', y=1.02, loc='left')
ax.set_title(title)
cbar=True, cmap=cmap, cbar_ax=cbar_ax,
cbar_kws={"orientation": "horizontal",
"ticks": [-1,-0.5, 0, 0.5, 1]} )
cbar_ax.set_title(r'Kendall $\tau$', y=1.02, loc='center', fontsize=6)
cbar_ax.tick_params(length=3)
for tick in cbar_ax.xaxis.get_major_ticks():
tick.label.set_fontsize(6)
ax.set_title(title, fontsize=8)
def mutation_plot2(ax, model='RS_pramidal'):
def mutation_plot(ax, model='RS_pramidal'):
models = ['RS_pyramidal', 'RS_inhib', 'FS', 'Cb_stellate', 'Cb_stellate_Kv', 'Cb_stellate_Kv_only', 'STN',
'STN_Kv', 'STN_Kv_only']
model_names = ['RS pyramidal', 'RS inhibitory', 'FS', #'RS pyramidal', 'RS inhibitory', 'FS', 'IB',
@@ -143,26 +150,33 @@ def mutation_plot2(ax, model='RS_pramidal'):
mod = models.index(model)
mut_names = AUC.index
ax.plot(rheo.loc[mut_names, model_names[mod]], AUC.loc[mut_names, model_names[mod]], linestyle='',
ax.plot(rheo.loc[mut_names, model_names[mod]]*1000, AUC.loc[mut_names, model_names[mod]], linestyle='',
markeredgecolor='grey', markerfacecolor='grey', marker=Marker_dict[model_display_names[mod]],
markersize=2) # markeredgecolor=clr_dict[model_names[mod]],markerfacecolor=clr_dict[model_names[mod]],
ax.plot(rheo.loc['wt', model_names[mod]], AUC.loc['wt', model_names[mod]], 'sk')
mut_col = sns.color_palette("pastel")
ax.plot(rheo.loc['V174F', model_names[mod]], AUC.loc['V174F', model_names[mod]], linestyle='',
ax.plot(rheo.loc['V174F', model_names[mod]]*1000, AUC.loc['V174F', model_names[mod]], linestyle='',
markeredgecolor=mut_col[0], markerfacecolor=mut_col[0], marker=Marker_dict[model_display_names[mod]],markersize=4)
ax.plot(rheo.loc['F414C', model_names[mod]], AUC.loc['F414C', model_names[mod]], linestyle='',
ax.plot(rheo.loc['F414C', model_names[mod]]*1000, AUC.loc['F414C', model_names[mod]], linestyle='',
markeredgecolor=mut_col[1], markerfacecolor=mut_col[1], marker=Marker_dict[model_display_names[mod]],markersize=4)
ax.plot(rheo.loc['E283K', model_names[mod]], AUC.loc['E283K', model_names[mod]], linestyle='',
ax.plot(rheo.loc['E283K', model_names[mod]]*1000, AUC.loc['E283K', model_names[mod]], linestyle='',
markeredgecolor=mut_col[2], markerfacecolor=mut_col[2], marker=Marker_dict[model_display_names[mod]],markersize=4)
ax.plot(rheo.loc['V404I', model_names[mod]], AUC.loc['V404I', model_names[mod]], linestyle='',
ax.plot(rheo.loc['V404I', model_names[mod]]*1000, AUC.loc['V404I', model_names[mod]], linestyle='',
markeredgecolor=mut_col[3], markerfacecolor=mut_col[5], marker=Marker_dict[model_display_names[mod]],markersize=4)
ax.set_title(model_display_names[mod])#, color=clr_dict[models[mod]]) , fontsize=14
ax.set_xlabel('$\Delta$ Rheobase (nA)', fontsize=6)
ax.set_ylabel('$AUC_{contrast}$', fontsize=6)
ax.set_title(model_display_names[mod], pad=14)#, color=clr_dict[models[mod]]) , fontsize=14
ax.set_xlabel('$\Delta$ Rheobase (pA)')#, fontsize=6)
ax.set_ylabel('Normalized $\Delta$AUC')#, fontsize=6)
ax.spines['right'].set_visible(False)
ax.spines['top'].set_visible(False)
# ax.ticklabel_format(style='scientific', useMathText=True, useOffset=False)
ax.ticklabel_format(axis="y", style="sci", scilimits=(0, 0),useMathText=True) #,useOffset=False
xmin, xmax = ax.get_xlim()
ymin, ymax = ax.get_ylim()
ax.hlines(0, xmin, xmax, colors='lightgrey', linestyles='--')
ax.vlines(0, ymin,ymax, colors='lightgrey', linestyles='--')
return ax
def mutation_legend(ax, marker_s_leg, pos, ncol):
@@ -186,9 +200,9 @@ def mutation_legend(ax, marker_s_leg, pos, ncol):
sim_style()
# plot setup
fig = plt.figure() #figsize=cm2inch(17.6,15)
gs0 = fig.add_gridspec(1, 6, wspace=3.5)
gsl = gs0[0:4].subgridspec(3, 3, wspace=0.9, hspace=0.8)
gsr = gs0[4:6].subgridspec(2, 1, wspace=0.6, hspace=1)
gs0 = fig.add_gridspec(1, 6, wspace=-0.2)
gsl = gs0[0:3].subgridspec(3, 3, wspace=0.9, hspace=0.8)
gsr = gs0[4:6].subgridspec(6, 1, wspace=0.6, hspace=1)
ax00 = fig.add_subplot(gsl[0,0])
ax01 = fig.add_subplot(gsl[0,1])
@@ -200,42 +214,42 @@ ax20 = fig.add_subplot(gsl[2,0])
ax21 = fig.add_subplot(gsl[2,1])
ax22 = fig.add_subplot(gsl[2,2])
axr0 = fig.add_subplot(gsr[0,0])
axr1 = fig.add_subplot(gsr[1,0])
axr0 = fig.add_subplot(gsr[0:2,0])
axr1 = fig.add_subplot(gsr[4:,0])
# plot mutations in each model
ax00 = mutation_plot2(ax00, model='RS_pyramidal')
ax01 = mutation_plot2(ax01, model='RS_inhib')
ax02 = mutation_plot2(ax02, model='FS')
ax10 = mutation_plot2(ax10, model='Cb_stellate')
ax11 = mutation_plot2(ax11, model='Cb_stellate_Kv')
ax12 = mutation_plot2(ax12, model='Cb_stellate_Kv_only')
ax20 = mutation_plot2(ax20, model='STN')
ax21 = mutation_plot2(ax21, model='STN_Kv')
ax22 = mutation_plot2(ax22, model='STN_Kv_only')
ax00 = mutation_plot(ax00, model='RS_pyramidal')
ax01 = mutation_plot(ax01, model='RS_inhib')
ax02 = mutation_plot(ax02, model='FS')
ax10 = mutation_plot(ax10, model='Cb_stellate')
ax11 = mutation_plot(ax11, model='Cb_stellate_Kv')
ax12 = mutation_plot(ax12, model='Cb_stellate_Kv_only')
ax20 = mutation_plot(ax20, model='STN')
ax21 = mutation_plot(ax21, model='STN_Kv')
ax22 = mutation_plot(ax22, model='STN_Kv_only')
marker_s_leg = 4
pos = (0.25, -0.45)
pos = (0.425, -0.7)
ncol = 5
mutation_legend(ax21, marker_s_leg, pos, ncol)
# plot correlation matrices
correlation_plot(axr1,df = 'AUC', title='$AUC_{contrast}$', cbar=False)
correlation_plot(axr0,df = 'rheo', title='$\Delta rheobase$', cbar=True)
correlation_plot(axr1,df = 'AUC', title='Normalized $\Delta$AUC', cbar=False)
correlation_plot(axr0,df = 'rheo', title='$\Delta$ Rheobase', cbar=True)
# add subplot labels
axs = [ax00, ax01,ax02, ax10, ax11, ax12, ax20, ax21, ax22]
j=0
for i in range(0,9):
axs[i].text(-0.48, 1.08, string.ascii_uppercase[i], transform=axs[i].transAxes, size=10, weight='bold')
axs[i].text(-0.48, 1.175, string.ascii_uppercase[i], transform=axs[i].transAxes, size=10, weight='bold')
j +=1
axr0.text(-0.38, 1.2, string.ascii_uppercase[j], transform=axr0.transAxes, size=10, weight='bold')
axr1.text(-0.38, 1.2, string.ascii_uppercase[j+1], transform=axr1.transAxes, size=10, weight='bold')
axr0.text(-0.77, 1.1, string.ascii_uppercase[j], transform=axr0.transAxes, size=10, weight='bold')
axr1.text(-0.77, 1.1, string.ascii_uppercase[j+1], transform=axr1.transAxes, size=10, weight='bold')
# save
# fig.savefig('./Figures/simulation_model_comparison.pdf') #, bbox_inches='tight'
print(fig.dpi)
fig.set_size_inches(cm2inch(17.95,15))
fig.set_size_inches(cm2inch(22.2,15))
fig.savefig('./Figures/simulation_model_comparison.pdf', dpi=fig.dpi) #bbox_inches='tight', dpi=fig.dpi
plt.show()