Update figures to be correct widths (17.6 and 8.5 cm)
This commit is contained in:
parent
b13c5127e5
commit
c5b2192d59
Binary file not shown.
@ -13,7 +13,14 @@ import matplotlib
|
||||
import matplotlib.lines as mlines
|
||||
from matplotlib import ticker
|
||||
from matplotlib.ticker import NullFormatter
|
||||
from plotstyle import boxplot_style
|
||||
|
||||
def cm2inch(*tupl):
|
||||
inch = 2.54
|
||||
if isinstance(tupl[0], tuple):
|
||||
return tuple(i/inch for i in tupl[0])
|
||||
else:
|
||||
return tuple(i/inch for i in tupl)
|
||||
#%% ##################### From https://stackoverflow.com/questions/52878845/swarmplot-with-hue-affecting-marker-beyond-color ##
|
||||
# to change marker types in seaborn swarmplot
|
||||
|
||||
@ -44,7 +51,7 @@ def GetColor2Marker(markers):
|
||||
mkcolors = [(palette[i]) for i in range(len(markers))]
|
||||
return dict(zip(mkcolors,markers))
|
||||
|
||||
def fixlegend(ax,markers,markersize=8,**kwargs):
|
||||
def fixlegend(ax,markers,markersize=3,**kwargs):
|
||||
# Fix Legend
|
||||
legtitle = ax.get_legend().get_title().get_text()
|
||||
_,l = ax.get_legend_handles_labels()
|
||||
@ -90,7 +97,7 @@ Axes.scatter = new_scatter
|
||||
########################################################################################################################
|
||||
|
||||
#%%
|
||||
def boxplot_with_markers(ax,max_width, alteration='shift'):
|
||||
def boxplot_with_markers(ax,max_width, alteration='shift', msize=3):
|
||||
# size =4
|
||||
# ax.tick_params(axis='x', rotation=90)
|
||||
model_names = ['RS pyramidal','RS inhibitory','FS',
|
||||
@ -126,7 +133,7 @@ def boxplot_with_markers(ax,max_width, alteration='shift'):
|
||||
# '#873770', # magenta
|
||||
# '#D03050' # pink
|
||||
# ]
|
||||
|
||||
hlinewidth =0.5
|
||||
|
||||
import matplotlib.colors
|
||||
colors = [matplotlib.colors.to_rgb(c) for c in colorslist] # sns.color_palette("hls", 14, desat=0.75)#[cm.tab20(i) for i in range(20)]
|
||||
@ -139,14 +146,14 @@ def boxplot_with_markers(ax,max_width, alteration='shift'):
|
||||
ax.axvspan(i - 0.4, i + 0.4, fill=False, edgecolor = 'k')
|
||||
df = pd.read_csv('./Figures/Data/AUC_shift_corr.csv')
|
||||
sns.swarmplot(y="corr", x="$\Delta V_{1/2}$", hue="model", data=df,
|
||||
palette=clr_dict, linewidth=0, orient='v', ax=ax,
|
||||
palette=clr_dict, linewidth=0, orient='v', ax=ax, size=msize,
|
||||
order=['Na activation', 'Na inactivation', 'K activation', '$K_V1.1$ activation',
|
||||
'$K_V1.1$ inactivation', 'A activation', 'A inactivation'],
|
||||
hue_order=model_names, co2mk=Markers)
|
||||
lim = ax.get_xlim()
|
||||
ax.plot([lim[0], lim[1]], [0, 0], ':r')
|
||||
ax.plot([lim[0], lim[1]], [1, 1], ':k')
|
||||
ax.plot([lim[0], lim[1]], [-1, -1], ':k')
|
||||
ax.plot([lim[0], lim[1]], [0, 0], ':r',linewidth=hlinewidth)
|
||||
ax.plot([lim[0], lim[1]], [1, 1], ':k',linewidth=hlinewidth)
|
||||
ax.plot([lim[0], lim[1]], [-1, -1], ':k',linewidth=hlinewidth)
|
||||
# ax.get_legend().remove()
|
||||
# sns.despine(trim=True, bottom=True, ax=ax)
|
||||
# ax.set(xlabel=None, ylabel=r'Kendall $\it{\tau}$')
|
||||
@ -158,15 +165,15 @@ def boxplot_with_markers(ax,max_width, alteration='shift'):
|
||||
|
||||
# Add in points to show each observation
|
||||
sns.swarmplot(y="corr", x="Slope (k)", hue="model", data=df, #dodge=True,
|
||||
palette=clr_dict, linewidth=0, orient='v', ax=ax,
|
||||
palette=clr_dict, linewidth=0, orient='v', ax=ax, size=msize,
|
||||
order=['Na activation', 'Na inactivation', 'K activation', '$K_V1.1$ activation',
|
||||
'$K_V1.1$ inactivation', 'A activation', 'A inactivation'],
|
||||
hue_order=model_names, co2mk=Markers)
|
||||
lim = ax.get_xlim()
|
||||
# ax.plot([lim[0], lim[1]], [0,0], ':k')
|
||||
ax.plot([lim[0], lim[1]], [0, 0], ':r')
|
||||
ax.plot([lim[0], lim[1]], [1, 1], ':k')
|
||||
ax.plot([lim[0], lim[1]], [-1, -1], ':k')
|
||||
ax.plot([lim[0], lim[1]], [0, 0], ':r',linewidth=hlinewidth)
|
||||
ax.plot([lim[0], lim[1]], [1, 1], ':k',linewidth=hlinewidth)
|
||||
ax.plot([lim[0], lim[1]], [-1, -1], ':k',linewidth=hlinewidth)
|
||||
# Markers = ["o","s","v","^","<",">","p","h","P","X","D","*","8","o"]
|
||||
# ax=fixlegend(ax, Markers)
|
||||
# Tweak the visual presentation
|
||||
@ -183,14 +190,14 @@ def boxplot_with_markers(ax,max_width, alteration='shift'):
|
||||
|
||||
# Add in points to show each observation
|
||||
sns.swarmplot(y="corr", x="g", hue="model", data=df, #dodge=True,
|
||||
palette=clr_dict, linewidth=0, orient='v', ax=ax,
|
||||
palette=clr_dict, linewidth=0, orient='v', ax=ax, size=msize,
|
||||
order=['Na', 'K', '$K_V1.1$', 'A', 'Leak'],
|
||||
hue_order=model_names, co2mk=Markers)
|
||||
lim = ax.get_xlim()
|
||||
# ax.plot([lim[0], lim[1]], [0,0], ':k')
|
||||
ax.plot([lim[0], lim[1]], [0, 0], ':r')
|
||||
ax.plot([lim[0], lim[1]], [1, 1], ':k')
|
||||
ax.plot([lim[0], lim[1]], [-1, -1], ':k')
|
||||
ax.plot([lim[0], lim[1]], [0, 0], ':r',linewidth=hlinewidth)
|
||||
ax.plot([lim[0], lim[1]], [1, 1], ':k',linewidth=hlinewidth)
|
||||
ax.plot([lim[0], lim[1]], [-1, -1], ':k',linewidth=hlinewidth)
|
||||
# Tweak the visual presentation
|
||||
# ax.xaxis.grid(False)
|
||||
# sns.despine(trim=True, bottom=True, ax=ax)
|
||||
@ -365,6 +372,7 @@ def plot_fI(ax, model='RS Pyramidal', type='shift', alt='m', color1='red', color
|
||||
|
||||
|
||||
#%%
|
||||
boxplot_style()
|
||||
color_dict = {'Cb stellate': '#40A787', # cyan'#
|
||||
'RS Inhibitory': '#F0D730', # yellow
|
||||
'FS': '#C02717', # red
|
||||
@ -380,16 +388,18 @@ color_dict = {'Cb stellate': '#40A787', # cyan'#
|
||||
}
|
||||
|
||||
# plot setup
|
||||
marker_s_leg = 8
|
||||
marker_s_leg = 2
|
||||
max_width = 10
|
||||
pad_x = 0.6
|
||||
pad_y= 0.3
|
||||
pad_w = 0.8
|
||||
pad_h = 0.5
|
||||
|
||||
fig = plt.figure(figsize=(18,10))
|
||||
gs = fig.add_gridspec(3, 6, wspace=0.9)
|
||||
plt.subplots_adjust(hspace=0.8) #, wspace=0.6
|
||||
pad_x = 0.65
|
||||
pad_y= 0.4
|
||||
pad_w = 0.85
|
||||
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., hspace=0.8)
|
||||
# plt.subplots_adjust(hspace=0.8) #, wspace=0.6
|
||||
ax0 = fig.add_subplot(gs[0,2:6])
|
||||
ax0_ex = fig.add_subplot(gs[0,1])
|
||||
ax0_fI = fig.add_subplot(gs[0,0])
|
||||
@ -400,27 +410,552 @@ ax2 = fig.add_subplot(gs[2,2:6])
|
||||
ax2_ex = fig.add_subplot(gs[2,1])
|
||||
ax2_fI = fig.add_subplot(gs[2,0])
|
||||
|
||||
line_width = 1
|
||||
# plot fI examples
|
||||
ax0_fI = plot_fI(ax0_fI, model='FS +$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$', type='shift', alt='s', color1='lightgrey', color2='k')
|
||||
rec = plt.Rectangle((-pad_x, -pad_y), 1 + pad_w, 1 + pad_h, fill=False, lw=line_width,transform=ax0_fI.transAxes, color=color_dict['FS +$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$'], alpha=1, zorder=-1)
|
||||
rec = ax0_fI.add_patch(rec)
|
||||
rec.set_clip_on(False)
|
||||
|
||||
ax1_fI = plot_fI(ax1_fI, model='FS +$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$', type='slope', alt='u', color1='lightgrey', color2='k')
|
||||
rec = plt.Rectangle((-pad_x, -pad_y), 1 + pad_w, 1 + pad_h, fill=False, lw=line_width,transform=ax1_fI.transAxes, color=color_dict['FS +$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$'], alpha=1, zorder=-1)
|
||||
rec = ax1_fI.add_patch(rec)
|
||||
rec.set_clip_on(False)
|
||||
|
||||
ax2_fI = plot_fI(ax2_fI, model='STN +$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$', type='g', alt='Leak', color1='lightgrey', color2='k')
|
||||
rec = plt.Rectangle((-pad_x, -pad_y), 1 + pad_w, 1 + pad_h, fill=False, lw=line_width,transform=ax2_fI.transAxes, color=color_dict['STN +$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$'], alpha=1, zorder=-1)
|
||||
rec = ax2_fI.add_patch(rec)
|
||||
rec.set_clip_on(False)
|
||||
|
||||
# label subplots with letters
|
||||
ax0_fI.text(-0.95, 1.12, string.ascii_uppercase[0], transform=ax0_fI.transAxes, size=10, weight='bold') #-0.09
|
||||
ax1_fI.text(-0.95, 1.12, string.ascii_uppercase[1], transform=ax1_fI.transAxes,size=10, weight='bold')
|
||||
ax2_fI.text(-0.95, 1.12, string.ascii_uppercase[2], transform=ax2_fI.transAxes,size=10, weight='bold')
|
||||
|
||||
# plot boxplots
|
||||
boxplot_with_markers(ax0,max_width, alteration='shift')
|
||||
boxplot_with_markers(ax1,max_width, alteration='slope')
|
||||
boxplot_with_markers(ax2,max_width, alteration='g')
|
||||
|
||||
# plot legend
|
||||
pos = (0.25, -0.6)
|
||||
ncol = 6
|
||||
model_legend(ax2, marker_s_leg, pos, ncol)
|
||||
|
||||
# plot examples
|
||||
plot_AUC_alt(ax0_ex,model='FS +$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$', color1='lightgrey', color2='k', alteration='shift')
|
||||
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')
|
||||
|
||||
#save
|
||||
# plt.tight_layout(pad=0)
|
||||
print(fig.dpi)
|
||||
fig.set_size_inches(cm2inch(21,10))
|
||||
fig.savefig('./Figures/AUC_correlation.pdf', dpi=fig.dpi) #bbox_inches='tight', dpi=fig.dpi
|
||||
plt.show()
|
||||
|
||||
# #%% alternative layout
|
||||
# # boxplot_style()
|
||||
# marker_s_leg = 8
|
||||
# max_width = 10
|
||||
# pad_x = 0.2
|
||||
# pad_y= 0.4
|
||||
# pad_w = 0.22
|
||||
# pad_h = 0.6
|
||||
#
|
||||
# fig = plt.figure(figsize=(12,20))
|
||||
# gs = fig.add_gridspec(3, 1, hspace=0.4, wspace=0.4)
|
||||
# gs0 = gs[0].subgridspec(2, 4, wspace=0.6, hspace=1.)
|
||||
# gs1 = gs[1].subgridspec(2, 4, wspace=0.6, hspace=1.)
|
||||
# gs2 = gs[2].subgridspec(2, 4, wspace=0.6, hspace=1.)
|
||||
# ax0 = fig.add_subplot(gs0[1,:])
|
||||
# ax0_ex = fig.add_subplot(gs0[0,2:])
|
||||
# ax0_fI = fig.add_subplot(gs0[0,:2])
|
||||
# ax1 = fig.add_subplot(gs1[1,:])
|
||||
# ax1_ex = fig.add_subplot(gs1[0,2:])
|
||||
# ax1_fI = fig.add_subplot(gs1[0,:2])
|
||||
# ax2 = fig.add_subplot(gs2[1,:])
|
||||
# ax2_ex = fig.add_subplot(gs2[0,2:])
|
||||
# ax2_fI = fig.add_subplot(gs2[0,:2])
|
||||
#
|
||||
#
|
||||
# ax0_fI = plot_fI(ax0_fI, model='FS +$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$', type='shift', alt='s', color1='lightgrey', color2='k')
|
||||
# rec = plt.Rectangle((-pad_x, -pad_y), 1 + pad_w, 1 + pad_h, fill=False, lw=2,transform=ax0_fI.transAxes, color=color_dict['FS +$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$'], alpha=1, zorder=-1)
|
||||
# rec = ax0_fI.add_patch(rec)
|
||||
# rec.set_clip_on(False)
|
||||
#
|
||||
# ax1_fI = plot_fI(ax1_fI, model='FS +$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$', type='slope', alt='u', color1='lightgrey', color2='k')
|
||||
# rec = plt.Rectangle((-pad_x, -pad_y), 1 + pad_w, 1 + pad_h, fill=False, lw=2,transform=ax1_fI.transAxes, color=color_dict['FS +$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$'], alpha=1, zorder=-1)
|
||||
# rec = ax1_fI.add_patch(rec)
|
||||
# rec.set_clip_on(False)
|
||||
#
|
||||
# ax2_fI = plot_fI(ax2_fI, model='STN +$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$', type='g', alt='Leak', color1='lightgrey', color2='k')
|
||||
# rec = plt.Rectangle((-pad_x, -pad_y), 1 + pad_w, 1 + pad_h, fill=False, lw=2,transform=ax2_fI.transAxes, color=color_dict['STN +$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$'], alpha=1, zorder=-1)
|
||||
# rec = ax2_fI.add_patch(rec)
|
||||
# rec.set_clip_on(False)
|
||||
#
|
||||
# # label subplots with letters
|
||||
# ax0_fI.text(-0.2, 1.38, string.ascii_uppercase[0], transform=ax0_fI.transAxes, size=16, weight='bold') #-0.09
|
||||
# ax1_fI.text(-0.2, 1.38, string.ascii_uppercase[1], transform=ax1_fI.transAxes,size=16, weight='bold')
|
||||
# ax2_fI.text(-0.2, 1.38, string.ascii_uppercase[2], transform=ax2_fI.transAxes,size=16, weight='bold')
|
||||
#
|
||||
# # plot boxplots
|
||||
# boxplot_with_markers(ax0,max_width, alteration='shift')
|
||||
# boxplot_with_markers(ax1,max_width, alteration='slope')
|
||||
# boxplot_with_markers(ax2,max_width, alteration='g')
|
||||
# # plot legend
|
||||
# pos = (0.5, -1.)
|
||||
# ncol = 6
|
||||
# model_legend(ax2, marker_s_leg, pos, ncol)
|
||||
#
|
||||
# # # plot rheo across model for example alteration
|
||||
# # plot_rheo_alt(ax0_ex,model='FS +$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$', color1='red', color2='maroon', alteration='shift')
|
||||
# # plot_rheo_alt(ax1_ex,model='Cb stellate +$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$', color1='orchid', color2='purple',alteration='slope')
|
||||
# # plot_rheo_alt(ax2_ex, model='Cb stellate', color1='darkviolet', color2='indigo', alteration='g')
|
||||
# # plot_rheo_alt(ax0_ex,model='FS +$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$', color1='lightgrey', color2='k', alteration='shift')
|
||||
# # 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')
|
||||
#
|
||||
# # plot examples
|
||||
# plot_AUC_alt(ax0_ex,model='FS', color1='lightgrey', color2='k', alteration='shift')
|
||||
# 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')
|
||||
# fig.savefig('AUC_correlation_2.pdf', bbox_inches='tight') #
|
||||
# # plt.saveas(fig, 'AUC_correlation_2.png')
|
||||
# plt.show()
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
Created on Sat Jul 3 19:52:04 2021
|
||||
|
||||
@author: nils
|
||||
"""
|
||||
import pandas as pd
|
||||
import numpy as np
|
||||
import string
|
||||
import textwrap
|
||||
import json
|
||||
import matplotlib
|
||||
import matplotlib.lines as mlines
|
||||
from matplotlib import ticker
|
||||
from matplotlib.ticker import NullFormatter
|
||||
from plotstyle import boxplot_style
|
||||
|
||||
def cm2inch(*tupl):
|
||||
inch = 2.54
|
||||
if isinstance(tupl[0], tuple):
|
||||
return tuple(i/inch for i in tupl[0])
|
||||
else:
|
||||
return tuple(i/inch for i in tupl)
|
||||
#%% ##################### From https://stackoverflow.com/questions/52878845/swarmplot-with-hue-affecting-marker-beyond-color ##
|
||||
# to change marker types in seaborn swarmplot
|
||||
|
||||
import seaborn as sns
|
||||
import matplotlib.pyplot as plt
|
||||
|
||||
############## Begin hack ##############
|
||||
from matplotlib.axes._axes import Axes
|
||||
from matplotlib.markers import MarkerStyle
|
||||
from numpy import ndarray
|
||||
|
||||
def GetColor2Marker(markers):
|
||||
colorslist = ['#40A787', # cyan'#
|
||||
'#F0D730', # yellow
|
||||
'#C02717', # red
|
||||
'#007030', # dark green
|
||||
'#AAB71B', # lightgreen
|
||||
'#008797', # light blue
|
||||
'#F78017', # orange
|
||||
'#478010', # green
|
||||
'#53379B', # purple
|
||||
'#2060A7', # blue
|
||||
'#873770', # magenta
|
||||
'#D03050' # pink
|
||||
]
|
||||
import matplotlib.colors
|
||||
palette = [matplotlib.colors.to_rgb(c) for c in colorslist]
|
||||
mkcolors = [(palette[i]) for i in range(len(markers))]
|
||||
return dict(zip(mkcolors,markers))
|
||||
|
||||
def fixlegend(ax,markers,markersize=3,**kwargs):
|
||||
# Fix Legend
|
||||
legtitle = ax.get_legend().get_title().get_text()
|
||||
_,l = ax.get_legend_handles_labels()
|
||||
colorslist = ['#40A787', # cyan'#
|
||||
'#F0D730', # yellow
|
||||
'#C02717', # red
|
||||
'#007030', # dark green
|
||||
'#AAB71B', # lightgreen
|
||||
'#008797', # light blue
|
||||
'#F78017', # orange
|
||||
'#478010', # green
|
||||
'#53379B', # purple
|
||||
'#2060A7', # blue
|
||||
'#873770', # magenta
|
||||
'#D03050' # pink
|
||||
]
|
||||
import matplotlib.colors
|
||||
palette = [matplotlib.colors.to_rgb(c) for c in colorslist]
|
||||
mkcolors = [(palette[i]) for i in range(len(markers))]
|
||||
newHandles = [plt.Line2D([0],[0], ls="none", marker=m, color=c, mec="none", markersize=markersize,**kwargs) \
|
||||
for m,c in zip(markers, mkcolors)]
|
||||
ax.legend(newHandles,l)
|
||||
leg = ax.get_legend()
|
||||
leg.set_title(legtitle)
|
||||
|
||||
old_scatter = Axes.scatter
|
||||
def new_scatter(self, *args, **kwargs):
|
||||
colors = kwargs.get("c", None)
|
||||
co2mk = kwargs.pop("co2mk",None)
|
||||
FinalCollection = old_scatter(self, *args, **kwargs)
|
||||
if co2mk is not None and isinstance(colors, ndarray):
|
||||
Color2Marker = GetColor2Marker(co2mk)
|
||||
paths=[]
|
||||
for col in colors:
|
||||
mk=Color2Marker[tuple(col)]
|
||||
marker_obj = MarkerStyle(mk)
|
||||
paths.append(marker_obj.get_path().transformed(marker_obj.get_transform()))
|
||||
FinalCollection.set_paths(paths)
|
||||
return FinalCollection
|
||||
Axes.scatter = new_scatter
|
||||
############## End hack. ##############
|
||||
|
||||
########################################################################################################################
|
||||
|
||||
#%%
|
||||
def boxplot_with_markers(ax,max_width, alteration='shift', msize=3):
|
||||
# size =4
|
||||
# ax.tick_params(axis='x', rotation=90)
|
||||
model_names = ['RS pyramidal','RS inhibitory','FS',
|
||||
'RS pyramidal +$K_V1.1$','RS inhibitory +$K_V1.1$',
|
||||
'FS +$K_V1.1$','Cb stellate','Cb stellate +$K_V1.1$',
|
||||
'Cb stellate $\Delta$$K_V1.1$','STN','STN +$K_V1.1$',
|
||||
'STN $\Delta$$K_V1.1$']
|
||||
|
||||
colorslist = ['#007030', # dark green
|
||||
'#F0D730', # yellow
|
||||
'#C02717', # red
|
||||
'#478010', # green
|
||||
'#AAB71B', # lightgreen
|
||||
'#F78017', # orange
|
||||
'#40A787', # cyan'#
|
||||
'#008797', # light blue
|
||||
'#2060A7', # blue
|
||||
'#D03050', # pink
|
||||
'#53379B', # purple
|
||||
'#873770', # magenta
|
||||
]
|
||||
|
||||
# colorslist = ['#40A787', # cyan'#
|
||||
# '#F0D730', # yellow
|
||||
# 'C02717', # red
|
||||
# '#007030', # dark green
|
||||
# '#AAB71B', # lightgreen
|
||||
# '#008797', # light blue
|
||||
# '#F78017', # orange
|
||||
# '#478010', # green
|
||||
# '#53379B', # purple
|
||||
# '#2060A7', # blue
|
||||
# '#873770', # magenta
|
||||
# '#D03050' # pink
|
||||
# ]
|
||||
hlinewidth =0.5
|
||||
|
||||
import matplotlib.colors
|
||||
colors = [matplotlib.colors.to_rgb(c) for c in colorslist] # sns.color_palette("hls", 14, desat=0.75)#[cm.tab20(i) for i in range(20)]
|
||||
clr_dict = {}
|
||||
for m in range(len(model_names)):
|
||||
clr_dict[model_names[m]] = colors[m]
|
||||
Markers = ["o", "o", "o", "^", "^", "^", "D", "D", "D", "s", "s", "s"]
|
||||
if alteration=='shift':
|
||||
i = 2 # Kd act
|
||||
ax.axvspan(i - 0.4, i + 0.4, fill=False, edgecolor = 'k')
|
||||
df = pd.read_csv('./Figures/Data/AUC_shift_corr.csv')
|
||||
sns.swarmplot(y="corr", x="$\Delta V_{1/2}$", hue="model", data=df,
|
||||
palette=clr_dict, linewidth=0, orient='v', ax=ax, size=msize,
|
||||
order=['Na activation', 'Na inactivation', 'K activation', '$K_V1.1$ activation',
|
||||
'$K_V1.1$ inactivation', 'A activation', 'A inactivation'],
|
||||
hue_order=model_names, co2mk=Markers)
|
||||
lim = ax.get_xlim()
|
||||
ax.plot([lim[0], lim[1]], [0, 0], ':r',linewidth=hlinewidth)
|
||||
ax.plot([lim[0], lim[1]], [1, 1], ':k',linewidth=hlinewidth)
|
||||
ax.plot([lim[0], lim[1]], [-1, -1], ':k',linewidth=hlinewidth)
|
||||
# ax.get_legend().remove()
|
||||
# sns.despine(trim=True, bottom=True, ax=ax)
|
||||
# ax.set(xlabel=None, ylabel=r'Kendall $\it{\tau}$')
|
||||
ax.set_title("Shift ($\Delta V_{1/2}$)", y=1.05)
|
||||
elif alteration=='slope':
|
||||
i = 3 # Kv1.1 act
|
||||
ax.axvspan(i - 0.4, i + 0.4, fill=False, edgecolor='k')
|
||||
df = pd.read_csv('./Figures/Data/AUC_scale_corr.csv')
|
||||
|
||||
# Add in points to show each observation
|
||||
sns.swarmplot(y="corr", x="Slope (k)", hue="model", data=df, #dodge=True,
|
||||
palette=clr_dict, linewidth=0, orient='v', ax=ax, size=msize,
|
||||
order=['Na activation', 'Na inactivation', 'K activation', '$K_V1.1$ activation',
|
||||
'$K_V1.1$ inactivation', 'A activation', 'A inactivation'],
|
||||
hue_order=model_names, co2mk=Markers)
|
||||
lim = ax.get_xlim()
|
||||
# ax.plot([lim[0], lim[1]], [0,0], ':k')
|
||||
ax.plot([lim[0], lim[1]], [0, 0], ':r',linewidth=hlinewidth)
|
||||
ax.plot([lim[0], lim[1]], [1, 1], ':k',linewidth=hlinewidth)
|
||||
ax.plot([lim[0], lim[1]], [-1, -1], ':k',linewidth=hlinewidth)
|
||||
# Markers = ["o","s","v","^","<",">","p","h","P","X","D","*","8","o"]
|
||||
# ax=fixlegend(ax, Markers)
|
||||
# Tweak the visual presentation
|
||||
# ax.get_legend().remove()
|
||||
# ax.xaxis.grid(False)
|
||||
# ax.set_xticklabels(textwrap.fill(x.get_text(), max_width) for x in ax.get_xticklabels())
|
||||
# ax.set(xlabel=None, ylabel=r'Kendall $\it{\tau}$')
|
||||
ax.set_title("Slope (k)", y=1.05)
|
||||
# sns.despine(trim=True, bottom=True, ax=ax)
|
||||
elif alteration=='g':
|
||||
i = 1 # Kd
|
||||
ax.axvspan(i - 0.4, i + 0.4, fill=False, edgecolor='k')
|
||||
df = pd.read_csv('./Figures/Data/AUC_g_corr.csv')
|
||||
|
||||
# Add in points to show each observation
|
||||
sns.swarmplot(y="corr", x="g", hue="model", data=df, #dodge=True,
|
||||
palette=clr_dict, linewidth=0, orient='v', ax=ax, size=msize,
|
||||
order=['Na', 'K', '$K_V1.1$', 'A', 'Leak'],
|
||||
hue_order=model_names, co2mk=Markers)
|
||||
lim = ax.get_xlim()
|
||||
# ax.plot([lim[0], lim[1]], [0,0], ':k')
|
||||
ax.plot([lim[0], lim[1]], [0, 0], ':r',linewidth=hlinewidth)
|
||||
ax.plot([lim[0], lim[1]], [1, 1], ':k',linewidth=hlinewidth)
|
||||
ax.plot([lim[0], lim[1]], [-1, -1], ':k',linewidth=hlinewidth)
|
||||
# Tweak the visual presentation
|
||||
# ax.xaxis.grid(False)
|
||||
# sns.despine(trim=True, bottom=True, ax=ax)
|
||||
# ax.set(xlabel=None, ylabel=r'Kendall $\it{\tau}$')
|
||||
ax.set_title("Conductance (g)", y=1.05)
|
||||
# ax.set_xticklabels(textwrap.fill(x.get_text(), max_width) for x in ax.get_xticklabels())
|
||||
else:
|
||||
print('Please chose "shift", "slope" or "g"')
|
||||
ax.get_legend().remove()
|
||||
ax.xaxis.grid(False)
|
||||
sns.despine(trim=True, bottom=True, ax=ax)
|
||||
ax.set(xlabel=None, ylabel=r'Kendall $\it{\tau}$')
|
||||
ax.set_xticklabels(textwrap.fill(x.get_text(), max_width) for x in ax.get_xticklabels())
|
||||
# fixlegend(ax, Markers)
|
||||
|
||||
def model_legend(ax, marker_s_leg, pos, ncol):
|
||||
colorslist = [ '#40A787', # cyan'#
|
||||
'#F0D730', # yellow
|
||||
'#C02717', # red
|
||||
'#007030', # dark green
|
||||
'#AAB71B', # lightgreen
|
||||
'#008797', # light blue
|
||||
'#F78017', # orange
|
||||
'#478010', # green
|
||||
'#53379B', # purple
|
||||
'#2060A7', # blue
|
||||
'#873770', # magenta
|
||||
'#D03050' # pink
|
||||
]
|
||||
import matplotlib.colors
|
||||
colors = [matplotlib.colors.to_rgb(c) for c in colorslist] #sns.color_palette("hls", 14, desat=0.75) #[cm.tab20(i) for i in range(20)]
|
||||
|
||||
model_pos = {'Cb stellate':0, 'RS Inhibitory':1, 'FS':2, 'RS Pyramidal':3,
|
||||
'RS Inhibitory +$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$':4,
|
||||
'Cb stellate +$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$':5, 'FS +$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$':6,
|
||||
'RS Pyramidal +$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$':7, 'STN +$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$':8,
|
||||
'Cb stellate $\Delta$$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$':9,
|
||||
'STN $\Delta$$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$':10, 'STN':11}
|
||||
|
||||
Markers = ["o", "o", "o", "^", "^", "^", "D", "D", "D", "s", "s", "s"]
|
||||
RS_p = mlines.Line2D([], [], color=colors[model_pos['RS Pyramidal']], marker=Markers[model_pos['RS Pyramidal']], markersize=marker_s_leg, linestyle='None',
|
||||
label='RS pyramidal')
|
||||
RS_i = mlines.Line2D([], [], color=colors[model_pos['RS Inhibitory']], marker=Markers[model_pos['RS Inhibitory']], markersize=marker_s_leg, linestyle='None',
|
||||
label='RS inhibitory')
|
||||
FS = mlines.Line2D([], [], color=colors[model_pos['FS']], marker=Markers[model_pos['FS']], markersize=marker_s_leg, linestyle='None', label='FS')
|
||||
RS_p_Kv = mlines.Line2D([], [], color=colors[model_pos['RS Pyramidal +$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$']], marker=Markers[model_pos['RS Pyramidal +$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$']], markersize=marker_s_leg, linestyle='None',
|
||||
label='RS Pyramidal +$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$')
|
||||
RS_i_Kv = mlines.Line2D([], [], color=colors[model_pos['RS Inhibitory +$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$']], marker=Markers[model_pos['RS Inhibitory +$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$']], markersize=marker_s_leg, linestyle='None',
|
||||
label='RS Inhibitory +$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$')
|
||||
FS_Kv = mlines.Line2D([], [], color=colors[model_pos['Cb stellate']], marker=Markers[model_pos['Cb stellate']], markersize=marker_s_leg, linestyle='None', label='FS +$K_V1.1$')
|
||||
Cb = mlines.Line2D([], [], color=colors[8], marker=Markers[8], markersize=marker_s_leg, linestyle='None',
|
||||
label='Cb stellate')
|
||||
Cb_pl = mlines.Line2D([], [], color=colors[model_pos['Cb stellate +$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$']], marker=Markers[model_pos['Cb stellate +$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$']], markersize=marker_s_leg, linestyle='None',
|
||||
label='Cb stellate +$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$')
|
||||
Cb_sw = mlines.Line2D([], [], color=colors[model_pos['Cb stellate $\Delta$$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$']], marker=Markers[model_pos['Cb stellate $\Delta$$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$']], markersize=marker_s_leg, linestyle='None',
|
||||
label='Cb stellate $\Delta$$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$')
|
||||
STN = mlines.Line2D([], [], color=colors[model_pos['STN']], marker=Markers[model_pos['STN']], markersize=marker_s_leg, linestyle='None', label='STN')
|
||||
STN_pl = mlines.Line2D([], [], color=colors[model_pos['STN +$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$']], marker=Markers[model_pos['STN +$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$']], markersize=marker_s_leg, linestyle='None',
|
||||
label='STN +$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$')
|
||||
STN_sw = mlines.Line2D([], [], color=colors[model_pos['STN $\Delta$$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$']], marker=Markers[model_pos['STN $\Delta$$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$']], markersize=marker_s_leg, linestyle='None',
|
||||
label='STN $\Delta$$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$')
|
||||
ax.legend(handles=[RS_p, RS_i, FS, RS_p_Kv, RS_i_Kv, FS_Kv, Cb, Cb_pl, Cb_sw, STN, STN_pl, STN_sw], loc='center',
|
||||
bbox_to_anchor=pos, ncol=ncol, frameon=False)
|
||||
|
||||
def plot_AUC_alt(ax, model='FS', color1='red', color2='dodgerblue', alteration='shift'):
|
||||
ax.spines["right"].set_visible(False)
|
||||
ax.spines["top"].set_visible(False)
|
||||
model_names = ['RS Pyramidal','RS Inhibitory','FS',
|
||||
'RS Pyramidal +$K_V1.1$','RS Inhibitory +$K_V1.1$',
|
||||
'FS +$K_V1.1$','Cb stellate','Cb stellate +$K_V1.1$',
|
||||
'Cb stellate $\Delta$$K_V1.1$','STN','STN +$K_V1.1$',
|
||||
'STN $\Delta$$K_V1.1$']
|
||||
|
||||
model_name_dict = {'RS Pyramidal': 'RS Pyramidal',
|
||||
'RS Inhibitory': 'RS Inhibitory',
|
||||
'FS': 'FS',
|
||||
'RS Pyramidal +$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$': 'RS Pyramidal +$K_V1.1$',
|
||||
'RS Inhibitory +$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$': 'RS Inhibitory +$K_V1.1$',
|
||||
'FS +$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$': 'FS +$K_V1.1$',
|
||||
'Cb stellate': 'Cb stellate',
|
||||
'Cb stellate +$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$': 'Cb stellate +$K_V1.1$',
|
||||
'Cb stellate $\Delta$$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$': 'Cb stellate $\Delta$$K_V1.1$',
|
||||
'STN': 'STN',
|
||||
'STN +$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$': 'STN +$K_V1.1$',
|
||||
'STN $\Delta$$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$': 'STN $\Delta$$K_V1.1$'}
|
||||
colorslist = ['#007030', # dark green
|
||||
'#F0D730', # yellow
|
||||
'#C02717', # red
|
||||
'#478010', # green
|
||||
'#AAB71B', # lightgreen
|
||||
'#F78017', # orange
|
||||
'#40A787', # cyan'#
|
||||
'#008797', # light blue
|
||||
'#2060A7', # blue
|
||||
'#D03050', # pink
|
||||
'#53379B', # purple
|
||||
'#873770', # magenta
|
||||
]
|
||||
|
||||
import matplotlib.colors
|
||||
colors = [matplotlib.colors.to_rgb(c) for c in
|
||||
colorslist] #sns.color_palette("hls", 14, desat=0.75)#[cm.tab20(i) for i in range(20)]
|
||||
clr_dict = {}
|
||||
for m in range(len(model_names)):
|
||||
clr_dict[model_names[m]] = colors[m]
|
||||
if alteration=='shift':
|
||||
df = pd.read_csv('./Figures/Data/AUC_shift_ex.csv')
|
||||
df = df.sort_values('alteration')
|
||||
ax.set_xlabel('$\Delta$$V_{1/2}$')
|
||||
elif alteration=='slope':
|
||||
df = pd.read_csv('./Figures/Data/AUC_slope_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('Slope factor k')
|
||||
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')
|
||||
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')
|
||||
x = df['alteration']
|
||||
y = df[model_name_dict[model]]
|
||||
ax.set_xlim(x.min(), x.max())
|
||||
ax.set_ylim(df[model_names].min().min(), df[model_names].max().max())
|
||||
return ax
|
||||
|
||||
def plot_fI(ax, model='RS Pyramidal', type='shift', alt='m', color1='red', color2='dodgerblue'):
|
||||
model_save_name = {'RS Pyramidal': 'RS_pyr_posp',
|
||||
'RS Inhibitory': 'RS_inhib_posp',
|
||||
'FS': 'FS_posp',
|
||||
'RS Pyramidal +$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$': 'RS_pyr_Kv',
|
||||
'RS Inhibitory +$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$': 'RS_inhib_Kv',
|
||||
'FS +$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$': 'FS_Kv',
|
||||
'Cb stellate': 'Cb_stellate',
|
||||
'Cb stellate +$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$': 'Cb_stellate_Kv',
|
||||
'Cb stellate $\Delta$$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$': 'Cb_stellate_Kv_only',
|
||||
'STN': 'STN',
|
||||
'STN +$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$': 'STN_Kv',
|
||||
'STN $\Delta$$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$': 'STN_Kv_only'}
|
||||
cvals = [-2., 2]
|
||||
colors = [color1, color2]
|
||||
norm = plt.Normalize(min(cvals), max(cvals))
|
||||
tuples = list(zip(map(norm, cvals), colors))
|
||||
cmap = matplotlib.colors.LinearSegmentedColormap.from_list("", tuples)
|
||||
colors = cmap(np.linspace(0, 1, 22))
|
||||
df = pd.read_csv('./Figures/Data/Model_fI/{}_fI.csv'.format(model_save_name[model]))
|
||||
df.drop(['Unnamed: 0'], axis=1)
|
||||
newdf = df.loc[df.index[(df['alt'] == alt) & (df['type'] == type)], :]
|
||||
newdf['mag'] = newdf['mag'].astype('float')
|
||||
newdf = newdf.sort_values('mag').reset_index()
|
||||
c = 0
|
||||
for i in newdf.index:
|
||||
ax.plot(json.loads(newdf.loc[i, 'I']), json.loads(newdf.loc[i, 'F']), color=colors[c])
|
||||
c += 1
|
||||
ax.set_ylabel('Frequency [Hz]')
|
||||
ax.set_xlabel('Current [nA]')
|
||||
ax.set_title(model)
|
||||
ax.spines["right"].set_visible(False)
|
||||
ax.spines["top"].set_visible(False)
|
||||
L = ax.get_ylim()
|
||||
ax.set_ylim([0, L[1]])
|
||||
return ax
|
||||
|
||||
|
||||
#%%
|
||||
boxplot_style()
|
||||
color_dict = {'Cb stellate': '#40A787', # cyan'#
|
||||
'RS Inhibitory': '#F0D730', # yellow
|
||||
'FS': '#C02717', # red
|
||||
'RS Pyramidal': '#007030', # dark green
|
||||
'RS Inhibitory +$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$': '#AAB71B', # lightgreen
|
||||
'Cb stellate +$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$': '#008797', # light blue
|
||||
'FS +$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$': '#F78017', # orange
|
||||
'RS Pyramidal +$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$': '#478010', # green
|
||||
'STN +$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$': '#53379B', # purple
|
||||
'Cb stellate $\Delta$$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$': '#2060A7', # blue
|
||||
'STN $\Delta$$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$': '#873770', # magenta
|
||||
'STN': '#D03050' # pink
|
||||
}
|
||||
|
||||
# plot setup
|
||||
marker_s_leg = 2
|
||||
max_width = 10
|
||||
pad_x = 0.65
|
||||
pad_y= 0.4
|
||||
pad_w = 0.85
|
||||
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., hspace=0.8)
|
||||
# plt.subplots_adjust(hspace=0.8) #, wspace=0.6
|
||||
ax0 = fig.add_subplot(gs[0,2:6])
|
||||
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_ex = fig.add_subplot(gs[1,1])
|
||||
ax1_fI = fig.add_subplot(gs[1,0])
|
||||
ax2 = fig.add_subplot(gs[2,2:6])
|
||||
ax2_ex = fig.add_subplot(gs[2,1])
|
||||
ax2_fI = fig.add_subplot(gs[2,0])
|
||||
|
||||
line_width = 1
|
||||
# plot fI examples
|
||||
ax0_fI = plot_fI(ax0_fI, model='FS +$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$', type='shift', alt='s', color1='lightgrey', color2='k')
|
||||
rec = plt.Rectangle((-pad_x, -pad_y), 1 + pad_w, 1 + pad_h, fill=False, lw=2,transform=ax0_fI.transAxes, color=color_dict['FS +$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$'], alpha=1, zorder=-1)
|
||||
rec = plt.Rectangle((-pad_x, -pad_y), 1 + pad_w, 1 + pad_h, fill=False, lw=line_width,transform=ax0_fI.transAxes, color=color_dict['FS +$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$'], alpha=1, zorder=-1)
|
||||
rec = ax0_fI.add_patch(rec)
|
||||
rec.set_clip_on(False)
|
||||
|
||||
ax1_fI = plot_fI(ax1_fI, model='FS +$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$', type='slope', alt='u', color1='lightgrey', color2='k')
|
||||
rec = plt.Rectangle((-pad_x, -pad_y), 1 + pad_w, 1 + pad_h, fill=False, lw=2,transform=ax1_fI.transAxes, color=color_dict['FS +$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$'], alpha=1, zorder=-1)
|
||||
rec = plt.Rectangle((-pad_x, -pad_y), 1 + pad_w, 1 + pad_h, fill=False, lw=line_width,transform=ax1_fI.transAxes, color=color_dict['FS +$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$'], alpha=1, zorder=-1)
|
||||
rec = ax1_fI.add_patch(rec)
|
||||
rec.set_clip_on(False)
|
||||
|
||||
ax2_fI = plot_fI(ax2_fI, model='STN +$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$', type='g', alt='Leak', color1='lightgrey', color2='k')
|
||||
rec = plt.Rectangle((-pad_x, -pad_y), 1 + pad_w, 1 + pad_h, fill=False, lw=2,transform=ax2_fI.transAxes, color=color_dict['STN +$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$'], alpha=1, zorder=-1)
|
||||
rec = plt.Rectangle((-pad_x, -pad_y), 1 + pad_w, 1 + pad_h, fill=False, lw=line_width,transform=ax2_fI.transAxes, color=color_dict['STN +$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$'], alpha=1, zorder=-1)
|
||||
rec = ax2_fI.add_patch(rec)
|
||||
rec.set_clip_on(False)
|
||||
|
||||
# label subplots with letters
|
||||
ax0_fI.text(-0.6, 1.28, string.ascii_uppercase[0], transform=ax0_fI.transAxes, size=16, weight='bold') #-0.09
|
||||
ax1_fI.text(-0.6, 1.28, string.ascii_uppercase[1], transform=ax1_fI.transAxes,size=16, weight='bold')
|
||||
ax2_fI.text(-0.6, 1.28, string.ascii_uppercase[2], transform=ax2_fI.transAxes,size=16, weight='bold')
|
||||
ax0_fI.text(-0.95, 1.12, string.ascii_uppercase[0], transform=ax0_fI.transAxes, size=10, weight='bold') #-0.09
|
||||
ax1_fI.text(-0.95, 1.12, string.ascii_uppercase[1], transform=ax1_fI.transAxes,size=10, weight='bold')
|
||||
ax2_fI.text(-0.95, 1.12, string.ascii_uppercase[2], transform=ax2_fI.transAxes,size=10, weight='bold')
|
||||
|
||||
# plot boxplots
|
||||
boxplot_with_markers(ax0,max_width, alteration='shift')
|
||||
@ -438,7 +973,10 @@ plot_AUC_alt(ax1_ex,model='FS +$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$', color1='l
|
||||
plot_AUC_alt(ax2_ex, model='STN +$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$', color1='lightgrey', color2='k', alteration='g')
|
||||
|
||||
#save
|
||||
fig.savefig('./Figures/AUC_correlation.pdf', bbox_inches='tight', dpi=fig.dpi)
|
||||
# plt.tight_layout(pad=0)
|
||||
print(fig.dpi)
|
||||
fig.set_size_inches(cm2inch(20.3,10))
|
||||
fig.savefig('./Figures/AUC_correlation.pdf', dpi=fig.dpi) #bbox_inches='tight', dpi=fig.dpi
|
||||
plt.show()
|
||||
|
||||
# #%% alternative layout
|
||||
|
Binary file not shown.
@ -6,6 +6,15 @@ from matplotlib.transforms import Bbox
|
||||
import string
|
||||
# from plotstyle import plot_style
|
||||
|
||||
|
||||
def cm2inch(*tupl):
|
||||
inch = 2.54
|
||||
if isinstance(tupl[0], tuple):
|
||||
return tuple(i/inch for i in tupl[0])
|
||||
else:
|
||||
return tuple(i/inch for i in tupl)
|
||||
plt.rcParams['xtick.labelsize'] = 6
|
||||
plt.rcParams['ytick.labelsize'] = 6
|
||||
#### from https://gist.github.com/dmeliza/3251476 #####################################################################
|
||||
from matplotlib.offsetbox import AnchoredOffsetbox
|
||||
class AnchoredScaleBar(AnchoredOffsetbox):
|
||||
@ -41,7 +50,7 @@ class AnchoredScaleBar(AnchoredOffsetbox):
|
||||
AnchoredOffsetbox.__init__(self, loc, pad=pad, borderpad=borderpad,
|
||||
child=bars, prop=prop, frameon=False, **kwargs)
|
||||
|
||||
|
||||
plt.rcParams.update({'font.size': 6})
|
||||
def add_scalebar(ax, matchx=True, matchy=True, hidex=True, hidey=True, **kwargs):
|
||||
""" Add scalebars to axes
|
||||
Adds a set of scale bars to *ax*, matching the size to the ticks of the plot
|
||||
@ -83,7 +92,7 @@ def plot_spike_train(ax, model='RS Pyramidal', stop=750):
|
||||
ax.set_xlabel('Time [s]')
|
||||
ax.set_ylim(-80, 60)
|
||||
ax.axis('off')
|
||||
ax.set_title(model)
|
||||
ax.set_title(model, fontsize=10)
|
||||
|
||||
|
||||
def plot_fI(ax, model='RS Pyramidal'):
|
||||
@ -119,10 +128,10 @@ def plot_fI(ax, model='RS Pyramidal'):
|
||||
#%%
|
||||
|
||||
# plot layout
|
||||
fig = plt.figure(figsize=(10,10))
|
||||
gs0 = fig.add_gridspec(3, 2, wspace=0.3)
|
||||
gs00 = gs0[:,0].subgridspec(6, 3, wspace=0.7, hspace=1)
|
||||
gs01 = gs0[:,1].subgridspec(6, 3, wspace=0.7, hspace=1)
|
||||
fig = plt.figure() #figsize=cm2inch(17.6,17.6)
|
||||
gs0 = fig.add_gridspec(3, 2, wspace=0.3, hspace=0)
|
||||
gs00 = gs0[:,0].subgridspec(6, 3, wspace=1.5, hspace=1.5)
|
||||
gs01 = gs0[:,1].subgridspec(6, 3, wspace=1.2, hspace=1.3)
|
||||
|
||||
ax1_spikes = fig.add_subplot(gs00[0,0:2])
|
||||
ax1_fI = fig.add_subplot(gs00[0, 2])
|
||||
@ -175,10 +184,13 @@ add_scalebar(ax12_spikes, matchx=False, matchy=False, hidex=True, hidey=True, si
|
||||
bbox_transform=ax12_spikes.transAxes)
|
||||
# add subplot labels
|
||||
for i in range(0,len(models)):
|
||||
spike_axs[i].text(-0.18, 1.08, string.ascii_uppercase[i], transform=spike_axs[i].transAxes, size=16, weight='bold')
|
||||
spike_axs[i].text(-0.18, 1.08, string.ascii_uppercase[i], transform=spike_axs[i].transAxes, size=10, weight='bold')
|
||||
|
||||
# save
|
||||
fig.savefig('./Figures/diversity_in_firing.pdf', bbox_inches='tight')
|
||||
# fig.savefig('./Figures/diversity_in_firing.pdf', bbox_inches='tight')
|
||||
print(fig.dpi)
|
||||
fig.set_size_inches(cm2inch(17.6,20))
|
||||
fig.savefig('./Figures/diversity_in_firing.pdf', dpi=fig.dpi) #bbox_inches='tight', dpi=fig.dpi
|
||||
plt.show()
|
||||
|
||||
|
||||
|
Binary file not shown.
@ -2,7 +2,15 @@ import numpy as np
|
||||
import matplotlib.pyplot as plt
|
||||
import matplotlib.gridspec as gridspec
|
||||
import string
|
||||
from plotstyle import plot_style
|
||||
# from plotstyle import plot_style
|
||||
from plotstyle import scheme_style
|
||||
|
||||
def cm2inch(*tupl):
|
||||
inch = 2.54
|
||||
if isinstance(tupl[0], tuple):
|
||||
return tuple(i/inch for i in tupl[0])
|
||||
else:
|
||||
return tuple(i/inch for i in tupl)
|
||||
|
||||
def plot_sqrt(ax, a=1, b=0.2, c=100, d=0):
|
||||
x = np.linspace(0, 1, 10000)
|
||||
@ -51,14 +59,15 @@ def plot_quadrant(ax):
|
||||
b[2] = '+'
|
||||
ax.set_yticklabels(b)
|
||||
|
||||
ax.tick_params(labelsize=16)
|
||||
# ax.tick_params(labelsize=16)
|
||||
# ax.set_yticks([0])
|
||||
# ax.axis('off')
|
||||
|
||||
|
||||
plot_style()
|
||||
# plot_style()
|
||||
scheme_style()
|
||||
|
||||
fig = plt.figure(figsize=(4, 6))
|
||||
fig = plt.figure(figsize=cm2inch(7, 12))
|
||||
gs = gridspec.GridSpec(3,2, top=0.95, bottom=0.1, left=0.15, right = 0.95, hspace=0.8, wspace=0.6)
|
||||
ax1 = fig.add_subplot(gs[0,:])
|
||||
plot_AUC(ax1, width=0.2)
|
||||
@ -80,30 +89,34 @@ plot_quadrant(ax3) # plot delineation into quadrants
|
||||
|
||||
inset_ylim = (0, 100)
|
||||
# top left
|
||||
lfsize = 8
|
||||
ax3.text(x=-0.75, y=0.25, s=r'''$\uparrow$ AUC
|
||||
$\downarrow$ rheobase''')
|
||||
$\downarrow$ rheobase''', fontsize=lfsize)
|
||||
ax3_TL = ax3.inset_axes([0, 0.8, 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.25, y=0.25, s=r'''$\uparrow$ AUC
|
||||
$\uparrow$ rheobase''')
|
||||
$\uparrow$ rheobase''', fontsize=lfsize)
|
||||
ax3_TR = ax3.inset_axes([0.7, 0.8, 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.75, y=-0.35, s=r'''$\downarrow$ AUC
|
||||
$\downarrow$ rheobase''')
|
||||
$\downarrow$ rheobase''', fontsize=lfsize)
|
||||
ax3_BL = ax3.inset_axes([0, 0, 0.3, 0.2])
|
||||
plot_diff_sqrt(ax3_BL, b2=0.1, c2=75)
|
||||
ax3_BL.set_ylim(inset_ylim)
|
||||
# bottom right
|
||||
ax3.text(x=0.25, y=-0.35, s=r'''$\downarrow$ AUC
|
||||
$\uparrow$ rheobase''')
|
||||
$\uparrow$ rheobase''', fontsize=lfsize)
|
||||
ax3_BR = ax3.inset_axes([0.7, 0, 0.3, 0.2])
|
||||
plot_diff_sqrt(ax3_BR, b2=0.4, c2=75)
|
||||
ax3_BR.set_ylim(inset_ylim)
|
||||
fig.savefig('./Figures/firing_characterization.pdf', bbox_inches='tight')
|
||||
# fig.savefig('./Figures/firing_characterization.pdf', bbox_inches='tight')
|
||||
print(fig.dpi)
|
||||
fig.set_size_inches(cm2inch(8.17,15))
|
||||
fig.savefig('./Figures/firing_characterization.pdf', dpi=fig.dpi) #bbox_inches='tight', dpi=fig.dpi
|
||||
plt.show()
|
||||
|
||||
|
||||
|
@ -1,3 +1,150 @@
|
||||
# # plot ramp protocol and responses of each model to ramp
|
||||
# import numpy as np
|
||||
# import pandas as pd
|
||||
# import matplotlib.pyplot as plt
|
||||
# import matplotlib.gridspec as gridspec
|
||||
# from matplotlib.transforms import Bbox
|
||||
# import string
|
||||
#
|
||||
# def cm2inch(*tupl):
|
||||
# inch = 2.54
|
||||
# if isinstance(tupl[0], tuple):
|
||||
# return tuple(i/inch for i in tupl[0])
|
||||
# else:
|
||||
# return tuple(i/inch for i in tupl)
|
||||
#
|
||||
# #### from https://gist.github.com/dmeliza/3251476 #####################################################################
|
||||
# from matplotlib.offsetbox import AnchoredOffsetbox
|
||||
# class AnchoredScaleBar(AnchoredOffsetbox):
|
||||
# def __init__(self, transform, sizex=0, sizey=0, labelx=None, labely=None, loc=4,
|
||||
# pad=0.1, borderpad=0.1, sep=2, prop=None, barcolor="black", barwidth=None,
|
||||
# **kwargs):
|
||||
# """
|
||||
# Draw a horizontal and/or vertical bar with the size in data coordinate
|
||||
# of the give axes. A label will be drawn underneath (center-aligned).
|
||||
# - transform : the coordinate frame (typically axes.transData)
|
||||
# - sizex,sizey : width of x,y bar, in data units. 0 to omit
|
||||
# - labelx,labely : labels for x,y bars; None to omit
|
||||
# - loc : position in containing axes
|
||||
# - pad, borderpad : padding, in fraction of the legend font size (or prop)
|
||||
# - sep : separation between labels and bars in points.
|
||||
# - **kwargs : additional arguments passed to base class constructor
|
||||
# """
|
||||
# from matplotlib.patches import Rectangle
|
||||
# from matplotlib.offsetbox import AuxTransformBox, VPacker, HPacker, TextArea, DrawingArea
|
||||
# bars = AuxTransformBox(transform)
|
||||
# if sizex:
|
||||
# bars.add_artist(Rectangle((0, 0), sizex, 0, ec=barcolor, lw=barwidth, fc="none"))
|
||||
# if sizey:
|
||||
# bars.add_artist(Rectangle((0, 0), 0, sizey, ec=barcolor, lw=barwidth, fc="none"))
|
||||
#
|
||||
# if sizex and labelx:
|
||||
# self.xlabel = TextArea(labelx)
|
||||
# bars = VPacker(children=[bars, self.xlabel], align="center", pad=0, sep=sep)
|
||||
# if sizey and labely:
|
||||
# self.ylabel = TextArea(labely)
|
||||
# bars = HPacker(children=[self.ylabel, bars], align="center", pad=0, sep=sep)
|
||||
#
|
||||
# AnchoredOffsetbox.__init__(self, loc, pad=pad, borderpad=borderpad,
|
||||
# child=bars, prop=prop, frameon=False, **kwargs)
|
||||
#
|
||||
#
|
||||
# def add_scalebar(ax, matchx=True, matchy=True, hidex=True, hidey=True, **kwargs):
|
||||
# """ Add scalebars to axes
|
||||
# Adds a set of scale bars to *ax*, matching the size to the ticks of the plot
|
||||
# and optionally hiding the x and y axes
|
||||
# - ax : the axis to attach ticks to
|
||||
# - matchx,matchy : if True, set size of scale bars to spacing between ticks
|
||||
# if False, size should be set using sizex and sizey params
|
||||
# - hidex,hidey : if True, hide x-axis and y-axis of parent
|
||||
# - **kwargs : additional arguments passed to AnchoredScaleBars
|
||||
# Returns created scalebar object
|
||||
# """
|
||||
#
|
||||
# def f(axis):
|
||||
# l = axis.get_majorticklocs()
|
||||
# return len(l) > 1 and (l[1] - l[0])
|
||||
#
|
||||
# if matchx:
|
||||
# kwargs['sizex'] = f(ax.xaxis)
|
||||
# kwargs['labelx'] = str(kwargs['sizex'])
|
||||
# if matchy:
|
||||
# kwargs['sizey'] = f(ax.yaxis)
|
||||
# kwargs['labely'] = str(kwargs['sizey'])
|
||||
#
|
||||
# sb = AnchoredScaleBar(ax.transData, **kwargs)
|
||||
# ax.add_artist(sb)
|
||||
#
|
||||
# if hidex: ax.xaxis.set_visible(False)
|
||||
# if hidey: ax.yaxis.set_visible(False)
|
||||
# if hidex and hidey: ax.set_frame_on(False)
|
||||
#
|
||||
# return sb
|
||||
# ########################################################################################################################
|
||||
#
|
||||
#
|
||||
# def plot_ramp_V(ax, model='RS Pyramidal'): # , stop=750
|
||||
# model_ramp = pd.read_csv('./Figures/Data/model_ramp.csv')
|
||||
# ax.plot(model_ramp['t'], model_ramp[model], 'k', linewidth=0.025)
|
||||
# ax.set_ylabel('V')
|
||||
# ax.set_xlabel('Time [s]')
|
||||
# ax.set_ylim(-80, 60)
|
||||
# ax.axis('off')
|
||||
# ax.set_title(model)
|
||||
#
|
||||
# #% plot setup
|
||||
# fig = plt.figure(figsize=cm2inch(17.6,17.6))
|
||||
#
|
||||
# gs0 = fig.add_gridspec(3, 2, wspace=0.1)
|
||||
# gs00 = gs0[:,0].subgridspec(7, 2, wspace=0.6, hspace=1)
|
||||
# gs01 = gs0[:,1].subgridspec(7, 2, wspace=0.6, hspace=1)
|
||||
#
|
||||
# ax1_ramp = fig.add_subplot(gs00[0,0:2])
|
||||
# ax2_ramp = fig.add_subplot(gs01[0,0:2])
|
||||
# ax3_ramp = fig.add_subplot(gs00[1,0:2])
|
||||
# ax4_ramp = fig.add_subplot(gs01[1,0:2])
|
||||
# ax5_ramp = fig.add_subplot(gs00[2, 0:2])
|
||||
# ax6_ramp = fig.add_subplot(gs01[2, 0:2])
|
||||
# ax7_ramp = fig.add_subplot(gs00[3,0:2])
|
||||
# ax8_ramp = fig.add_subplot(gs01[3,0:2])
|
||||
# ax9_ramp = fig.add_subplot(gs00[4,0:2])
|
||||
# ax10_ramp = fig.add_subplot(gs01[4,0:2])
|
||||
# ax11_ramp = fig.add_subplot(gs00[5,0:2])
|
||||
# ax12_ramp = fig.add_subplot(gs01[5,0:2])
|
||||
#
|
||||
# ramp_axs = [ax1_ramp, ax2_ramp, ax3_ramp, ax4_ramp, ax5_ramp,ax6_ramp, ax7_ramp, ax8_ramp,
|
||||
# ax9_ramp, ax10_ramp, ax11_ramp, ax12_ramp]
|
||||
#
|
||||
# # order of models
|
||||
# models = ['Cb stellate','RS Inhibitory','FS', 'RS Pyramidal','RS Inhibitory +$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$',
|
||||
# 'Cb stellate +$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$', 'FS +$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$',
|
||||
# 'RS Pyramidal +$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$', 'STN +$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$',
|
||||
# 'Cb stellate $\Delta$$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$',
|
||||
# 'STN $\Delta$$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$', 'STN']
|
||||
#
|
||||
# # plot ramps
|
||||
# for i in range(len(models)):
|
||||
# plot_ramp_V(ramp_axs[i], model=models[i])
|
||||
#
|
||||
# # add scalebar
|
||||
# plt.rcParams.update({'font.size': 6})
|
||||
#
|
||||
# add_scalebar(ax11_ramp, matchx=False, matchy=False, hidex=True, hidey=True, sizex=1000, sizey=50, labelx='1 s',
|
||||
# labely='50 mV', loc=3, pad=-2, borderpad=0, barwidth=1, bbox_to_anchor=Bbox.from_bounds(-0.05, 0.1, 1, 1),
|
||||
# bbox_transform=ax11_ramp.transAxes)
|
||||
# # add_scalebar(ax12_ramp, matchx=False, matchy=False, hidex=True, hidey=True, sizex=1000, sizey=25, labelx='1 s',
|
||||
# # labely='25 mV', loc=3, pad=-2, borderpad=0, barwidth=2, bbox_to_anchor=Bbox.from_bounds(-0.05, 0.1, 1, 1),
|
||||
# # bbox_transform=ax12_ramp.transAxes)
|
||||
#
|
||||
# # add subplot labels
|
||||
# for i in range(0,len(models)):
|
||||
# ramp_axs[i].text(-0.05, 1.08, string.ascii_uppercase[i], transform=ramp_axs[i].transAxes, size=10, weight='bold')
|
||||
#
|
||||
# fig.savefig('./Figures/ramp_firing.pdf', dpi=3000)
|
||||
# plt.show()
|
||||
|
||||
|
||||
|
||||
# plot ramp protocol and responses of each model to ramp
|
||||
import numpy as np
|
||||
import pandas as pd
|
||||
@ -6,6 +153,13 @@ import matplotlib.gridspec as gridspec
|
||||
from matplotlib.transforms import Bbox
|
||||
import string
|
||||
|
||||
def cm2inch(*tupl):
|
||||
inch = 2.54
|
||||
if isinstance(tupl[0], tuple):
|
||||
return tuple(i/inch for i in tupl[0])
|
||||
else:
|
||||
return tuple(i/inch for i in tupl)
|
||||
|
||||
#### from https://gist.github.com/dmeliza/3251476 #####################################################################
|
||||
from matplotlib.offsetbox import AnchoredOffsetbox
|
||||
class AnchoredScaleBar(AnchoredOffsetbox):
|
||||
@ -78,32 +232,32 @@ def add_scalebar(ax, matchx=True, matchy=True, hidex=True, hidey=True, **kwargs)
|
||||
|
||||
def plot_ramp_V(ax, model='RS Pyramidal'): # , stop=750
|
||||
model_ramp = pd.read_csv('./Figures/Data/model_ramp.csv')
|
||||
ax.plot(model_ramp['t'], model_ramp[model], 'k', linewidth=0.25)
|
||||
ax.plot(model_ramp['t'], model_ramp[model], 'k', linewidth=0.0025)
|
||||
ax.set_ylabel('V')
|
||||
ax.set_xlabel('Time [s]')
|
||||
ax.set_ylim(-80, 60)
|
||||
ax.axis('off')
|
||||
ax.set_title(model)
|
||||
ax.set_title(model, fontsize=8)
|
||||
|
||||
#% plot setup
|
||||
fig = plt.figure(figsize=(20,10))
|
||||
|
||||
gs0 = fig.add_gridspec(3, 2, wspace=0.1)
|
||||
gs00 = gs0[:,0].subgridspec(7, 2, wspace=0.6, hspace=1)
|
||||
gs01 = gs0[:,1].subgridspec(7, 2, wspace=0.6, hspace=1)
|
||||
|
||||
ax1_ramp = fig.add_subplot(gs00[0,0:2])
|
||||
ax2_ramp = fig.add_subplot(gs01[0,0:2])
|
||||
ax3_ramp = fig.add_subplot(gs00[1,0:2])
|
||||
ax4_ramp = fig.add_subplot(gs01[1,0:2])
|
||||
ax5_ramp = fig.add_subplot(gs00[2, 0:2])
|
||||
ax6_ramp = fig.add_subplot(gs01[2, 0:2])
|
||||
ax7_ramp = fig.add_subplot(gs00[3,0:2])
|
||||
ax8_ramp = fig.add_subplot(gs01[3,0:2])
|
||||
ax9_ramp = fig.add_subplot(gs00[4,0:2])
|
||||
ax10_ramp = fig.add_subplot(gs01[4,0:2])
|
||||
ax11_ramp = fig.add_subplot(gs00[5,0:2])
|
||||
ax12_ramp = fig.add_subplot(gs01[5,0:2])
|
||||
fig = plt.figure(figsize=cm2inch(17.6,25))
|
||||
|
||||
gs0 = fig.add_gridspec(2, 1, wspace=0.)
|
||||
gs00 = gs0[:].subgridspec(12, 1, wspace=0.7, hspace=1.0)
|
||||
# gs01 = gs0[1:].subgridspec(7, 2, wspace=0.6, hspace=1)
|
||||
|
||||
ax1_ramp = fig.add_subplot(gs00[0])
|
||||
ax2_ramp = fig.add_subplot(gs00[1])
|
||||
ax3_ramp = fig.add_subplot(gs00[2])
|
||||
ax4_ramp = fig.add_subplot(gs00[3])
|
||||
ax5_ramp = fig.add_subplot(gs00[4])
|
||||
ax6_ramp = fig.add_subplot(gs00[5])
|
||||
ax7_ramp = fig.add_subplot(gs00[6])
|
||||
ax8_ramp = fig.add_subplot(gs00[7])
|
||||
ax9_ramp = fig.add_subplot(gs00[8])
|
||||
ax10_ramp = fig.add_subplot(gs00[9])
|
||||
ax11_ramp = fig.add_subplot(gs00[10])
|
||||
ax12_ramp = fig.add_subplot(gs00[11])
|
||||
|
||||
ramp_axs = [ax1_ramp, ax2_ramp, ax3_ramp, ax4_ramp, ax5_ramp,ax6_ramp, ax7_ramp, ax8_ramp,
|
||||
ax9_ramp, ax10_ramp, ax11_ramp, ax12_ramp]
|
||||
@ -120,16 +274,22 @@ for i in range(len(models)):
|
||||
plot_ramp_V(ramp_axs[i], model=models[i])
|
||||
|
||||
# add scalebar
|
||||
add_scalebar(ax11_ramp, matchx=False, matchy=False, hidex=True, hidey=True, sizex=1000, sizey=25, labelx='1 s',
|
||||
labely='25 mV', loc=3, pad=-2, borderpad=0, barwidth=2, bbox_to_anchor=Bbox.from_bounds(-0.05, 0.1, 1, 1),
|
||||
bbox_transform=ax11_ramp.transAxes)
|
||||
plt.rcParams.update({'font.size': 6})
|
||||
|
||||
add_scalebar(ax12_ramp, matchx=False, matchy=False, hidex=True, hidey=True, sizex=1000, sizey=50, labelx='1 s',
|
||||
labely='50 mV', loc=3, pad=-2, borderpad=0, barwidth=1, bbox_to_anchor=Bbox.from_bounds(0.01, 0.05, 1, 1),
|
||||
bbox_transform=ax12_ramp.transAxes)
|
||||
# add_scalebar(ax12_ramp, matchx=False, matchy=False, hidex=True, hidey=True, sizex=1000, sizey=25, labelx='1 s',
|
||||
# labely='25 mV', loc=3, pad=-2, borderpad=0, barwidth=2, bbox_to_anchor=Bbox.from_bounds(-0.05, 0.1, 1, 1),
|
||||
# bbox_transform=ax12_ramp.transAxes)
|
||||
|
||||
# add subplot labels
|
||||
for i in range(0,len(models)):
|
||||
ramp_axs[i].text(-0.05, 1.08, string.ascii_uppercase[i], transform=ramp_axs[i].transAxes, size=16, weight='bold')
|
||||
ramp_axs[i].text(-0.01, 1.1, string.ascii_uppercase[i], transform=ramp_axs[i].transAxes, size=10, weight='bold')
|
||||
|
||||
fig.savefig('./Figures/ramp_firing.pdf')
|
||||
# fig.savefig('./Figures/ramp_firing.pdf') #, bbox_inches='tight'
|
||||
print(fig.dpi)
|
||||
fig.set_size_inches(cm2inch(17.6,20))
|
||||
fig.savefig('./Figures/ramp_firing.pdf', dpi=fig.dpi) #bbox_inches='tight', dpi=fig.dpi
|
||||
plt.show()
|
||||
|
||||
|
Binary file not shown.
Binary file not shown.
@ -13,7 +13,15 @@ import matplotlib
|
||||
import matplotlib.lines as mlines
|
||||
from matplotlib import ticker
|
||||
from matplotlib.ticker import NullFormatter
|
||||
from plotstyle import boxplot_style
|
||||
|
||||
|
||||
def cm2inch(*tupl):
|
||||
inch = 2.54
|
||||
if isinstance(tupl[0], tuple):
|
||||
return tuple(i/inch for i in tupl[0])
|
||||
else:
|
||||
return tuple(i/inch for i in tupl)
|
||||
#%% ##################### From https://stackoverflow.com/questions/52878845/swarmplot-with-hue-affecting-marker-beyond-color ##
|
||||
# to change marker types in seaborn swarmplot
|
||||
|
||||
@ -44,7 +52,7 @@ def GetColor2Marker(markers):
|
||||
mkcolors = [(palette[i]) for i in range(len(markers))]
|
||||
return dict(zip(mkcolors,markers))
|
||||
|
||||
def fixlegend(ax,markers,markersize=8,**kwargs):
|
||||
def fixlegend(ax,markers,markersize=3,**kwargs):
|
||||
# Fix Legend
|
||||
legtitle = ax.get_legend().get_title().get_text()
|
||||
_,l = ax.get_legend_handles_labels()
|
||||
@ -90,8 +98,9 @@ Axes.scatter = new_scatter
|
||||
########################################################################################################################
|
||||
|
||||
#%%
|
||||
def boxplot_with_markers(ax,max_width, alteration='shift'):
|
||||
def boxplot_with_markers(ax,max_width, alteration='shift', msize=2.2):
|
||||
# size =4
|
||||
hlinewidth = 0.5
|
||||
# ax.tick_params(axis='x', rotation=90)
|
||||
model_names = ['RS pyramidal','RS inhibitory','FS',
|
||||
'RS pyramidal +$K_V1.1$','RS inhibitory +$K_V1.1$',
|
||||
@ -125,14 +134,14 @@ def boxplot_with_markers(ax,max_width, alteration='shift'):
|
||||
df = pd.read_csv('./Figures/Data/rheo_shift_corr.csv')
|
||||
|
||||
sns.swarmplot(y="corr", x="$\Delta V_{1/2}$", hue="model", data=df, #dodge=True,
|
||||
palette=clr_dict, linewidth=0, orient='v', ax=ax,
|
||||
palette=clr_dict, linewidth=0, orient='v', ax=ax, size=msize,
|
||||
order=['Na activation', 'Na inactivation', 'K activation', '$K_V1.1$ activation',
|
||||
'$K_V1.1$ inactivation', 'A activation', 'A inactivation'],
|
||||
hue_order=model_names, co2mk=Markers)
|
||||
lim = ax.get_xlim()
|
||||
ax.plot([lim[0], lim[1]], [0, 0], ':r')
|
||||
ax.plot([lim[0], lim[1]], [1, 1], ':k')
|
||||
ax.plot([lim[0], lim[1]], [-1, -1], ':k')
|
||||
ax.plot([lim[0], lim[1]], [0, 0], ':r',linewidth=hlinewidth)
|
||||
ax.plot([lim[0], lim[1]], [1, 1], ':k',linewidth=hlinewidth)
|
||||
ax.plot([lim[0], lim[1]], [-1, -1], ':k',linewidth=hlinewidth)
|
||||
ax.set_title("Shift ($\Delta V_{1/2}$)", y=1.05)
|
||||
elif alteration=='slope':
|
||||
i = 4 # Kv1.1 inact
|
||||
@ -141,14 +150,14 @@ def boxplot_with_markers(ax,max_width, alteration='shift'):
|
||||
|
||||
# Add in points to show each observation
|
||||
sns.swarmplot(y="corr", x="Slope (k)", hue="model", data=df, #dodge=True,
|
||||
palette=clr_dict, linewidth=0, orient='v', ax=ax,
|
||||
palette=clr_dict, linewidth=0, orient='v', ax=ax, size=msize,
|
||||
order=['Na activation', 'Na inactivation', 'K activation', '$K_V1.1$ activation',
|
||||
'$K_V1.1$ inactivation', 'A activation', 'A inactivation'],
|
||||
hue_order=model_names, co2mk=Markers)
|
||||
lim = ax.get_xlim()
|
||||
ax.plot([lim[0], lim[1]], [0, 0], ':r')
|
||||
ax.plot([lim[0], lim[1]], [1, 1], ':k')
|
||||
ax.plot([lim[0], lim[1]], [-1, -1], ':k')
|
||||
ax.plot([lim[0], lim[1]], [0, 0], ':r',linewidth=hlinewidth)
|
||||
ax.plot([lim[0], lim[1]], [1, 1], ':k',linewidth=hlinewidth)
|
||||
ax.plot([lim[0], lim[1]], [-1, -1], ':k',linewidth=hlinewidth)
|
||||
ax.set_title("Slope (k)", y=1.05)
|
||||
elif alteration=='g':
|
||||
i = 4 # Leak
|
||||
@ -157,13 +166,13 @@ def boxplot_with_markers(ax,max_width, alteration='shift'):
|
||||
|
||||
# Add in points to show each observation
|
||||
sns.swarmplot(y="corr", x="g", hue="model", data=df, #dodge=True,
|
||||
palette=clr_dict, linewidth=0, orient='v', ax=ax,
|
||||
palette=clr_dict, linewidth=0, orient='v', ax=ax, size=msize,
|
||||
order=['Na', 'K', '$K_V1.1$', 'A', 'Leak'],
|
||||
hue_order=model_names, co2mk=Markers)
|
||||
lim = ax.get_xlim()
|
||||
ax.plot([lim[0], lim[1]], [0, 0], ':r')
|
||||
ax.plot([lim[0], lim[1]], [1, 1], ':k')
|
||||
ax.plot([lim[0], lim[1]], [-1, -1], ':k')
|
||||
ax.plot([lim[0], lim[1]], [0, 0], ':r',linewidth=hlinewidth)
|
||||
ax.plot([lim[0], lim[1]], [1, 1], ':k',linewidth=hlinewidth)
|
||||
ax.plot([lim[0], lim[1]], [-1, -1], ':k',linewidth=hlinewidth)
|
||||
ax.set_title("Conductance (g)", y=1.05)
|
||||
else:
|
||||
print('Please chose "shift", "slope" or "g"')
|
||||
@ -335,6 +344,7 @@ def plot_fI(ax, model='RS Pyramidal', type='shift', alt='m', color1='red', color
|
||||
|
||||
|
||||
#%%
|
||||
boxplot_style()
|
||||
color_dict = {'Cb stellate': '#40A787', # cyan'#
|
||||
'RS Inhibitory': '#F0D730', # yellow
|
||||
'FS': '#C02717', # red
|
||||
@ -350,16 +360,16 @@ color_dict = {'Cb stellate': '#40A787', # cyan'#
|
||||
}
|
||||
|
||||
# plot setup
|
||||
marker_s_leg = 8
|
||||
marker_s_leg = 2
|
||||
max_width = 10
|
||||
pad_x = 0.6
|
||||
pad_y= 0.3
|
||||
pad_w = 0.8
|
||||
pad_h = 0.5
|
||||
|
||||
fig = plt.figure(figsize=(18,10))
|
||||
gs = fig.add_gridspec(3, 6, wspace=0.9)
|
||||
plt.subplots_adjust(hspace=0.8) #, wspace=0.6
|
||||
pad_x = 0.65
|
||||
pad_y= 0.4
|
||||
pad_w = 0.85
|
||||
pad_h = 0.7
|
||||
|
||||
fig = plt.figure(figsize=cm2inch(17.6,10))
|
||||
gs = fig.add_gridspec(3, 6, wspace=1., hspace=0.8)
|
||||
# plt.subplots_adjust(hspace=0.8) #, wspace=0.6
|
||||
ax0 = fig.add_subplot(gs[0,2:6])
|
||||
ax0_ex = fig.add_subplot(gs[0,1])
|
||||
ax0_fI = fig.add_subplot(gs[0,0])
|
||||
@ -370,26 +380,27 @@ ax2 = fig.add_subplot(gs[2,2:6])
|
||||
ax2_ex = fig.add_subplot(gs[2,1])
|
||||
ax2_fI = fig.add_subplot(gs[2,0])
|
||||
|
||||
line_width = 1
|
||||
# plot fI curves
|
||||
ax0_fI = plot_fI(ax0_fI, model='FS +$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$', type='shift', alt='s', color1='lightgrey', color2='k')
|
||||
rec = plt.Rectangle((-pad_x, -pad_y), 1 + pad_w, 1 + pad_h, fill=False, lw=2,transform=ax0_fI.transAxes, color=color_dict['FS +$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$'], alpha=1, zorder=-1)
|
||||
rec = plt.Rectangle((-pad_x, -pad_y), 1 + pad_w, 1 + pad_h, fill=False, lw=line_width,transform=ax0_fI.transAxes, color=color_dict['FS +$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$'], alpha=1, zorder=-1)
|
||||
rec = ax0_fI.add_patch(rec)
|
||||
rec.set_clip_on(False)
|
||||
|
||||
ax1_fI = plot_fI(ax1_fI, model='Cb stellate +$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$', type='slope', alt='u', color1='lightgrey', color2='k')
|
||||
rec = plt.Rectangle((-pad_x, -pad_y), 1 + pad_w, 1 + pad_h, fill=False, lw=2,transform=ax1_fI.transAxes, color=color_dict['Cb stellate +$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$'], alpha=1, zorder=-1)
|
||||
rec = plt.Rectangle((-pad_x, -pad_y), 1 + pad_w, 1 + pad_h, fill=False, lw=line_width,transform=ax1_fI.transAxes, color=color_dict['Cb stellate +$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$'], alpha=1, zorder=-1)
|
||||
rec = ax1_fI.add_patch(rec)
|
||||
rec.set_clip_on(False)
|
||||
|
||||
ax2_fI = plot_fI(ax2_fI, model='Cb stellate', type='g', alt='Leak', color1='lightgrey', color2='k')
|
||||
rec = plt.Rectangle((-pad_x, -pad_y), 1 + pad_w, 1 + pad_h, fill=False, lw=2,transform=ax2_fI.transAxes, color=color_dict['Cb stellate'], alpha=1, zorder=-1)
|
||||
rec = plt.Rectangle((-pad_x, -pad_y), 1 + pad_w, 1 + pad_h, fill=False, lw=line_width,transform=ax2_fI.transAxes, color=color_dict['Cb stellate'], alpha=1, zorder=-1)
|
||||
rec = ax2_fI.add_patch(rec)
|
||||
rec.set_clip_on(False)
|
||||
|
||||
# label fI subplots with letters
|
||||
ax0_fI.text(-0.6, 1.28, string.ascii_uppercase[0], transform=ax0_fI.transAxes, size=16, weight='bold') #-0.09
|
||||
ax1_fI.text(-0.6, 1.28, string.ascii_uppercase[1], transform=ax1_fI.transAxes,size=16, weight='bold')
|
||||
ax2_fI.text(-0.6, 1.28, string.ascii_uppercase[2], transform=ax2_fI.transAxes,size=16, weight='bold')
|
||||
ax0_fI.text(-0.95, 1.12, string.ascii_uppercase[0], transform=ax0_fI.transAxes, size=10, weight='bold') #-0.09
|
||||
ax1_fI.text(-0.95, 1.12, string.ascii_uppercase[1], transform=ax1_fI.transAxes,size=10, weight='bold')
|
||||
ax2_fI.text(-0.95, 1.12, string.ascii_uppercase[2], transform=ax2_fI.transAxes,size=10, weight='bold')
|
||||
|
||||
# plot boxplots
|
||||
boxplot_with_markers(ax0,max_width, alteration='shift')
|
||||
@ -407,7 +418,10 @@ plot_rheo_alt(ax1_ex,model='Cb stellate +$\mathrm{K}_{\mathrm{V}}\mathrm{1.1}$',
|
||||
plot_rheo_alt(ax2_ex, model='Cb stellate', color1='lightgrey', color2='k', alteration='g')
|
||||
|
||||
# save
|
||||
fig.savefig('./Figures/rheobase_correlation.pdf', bbox_inches='tight')
|
||||
# fig.savefig('./Figures/rheobase_correlation.pdf', bbox_inches='tight')
|
||||
print(fig.dpi)
|
||||
fig.set_size_inches(cm2inch(20.3,10))
|
||||
fig.savefig('./Figures/rheobase_correlation.pdf', dpi=fig.dpi) #bbox_inches='tight', dpi=fig.dpi
|
||||
plt.show()
|
||||
|
||||
# #%% alternative layout
|
||||
|
Binary file not shown.
@ -3,11 +3,18 @@ import matplotlib.pyplot as plt
|
||||
import pandas as pd
|
||||
import os
|
||||
import string
|
||||
from plotstyle import plot_style
|
||||
# from plotstyle import plot_style
|
||||
from plotstyle import sim_style
|
||||
import seaborn as sns
|
||||
import scipy.stats as stats
|
||||
import matplotlib.lines as mlines
|
||||
|
||||
def cm2inch(*tupl):
|
||||
inch = 2.54
|
||||
if isinstance(tupl[0], tuple):
|
||||
return tuple(i/inch for i in tupl[0])
|
||||
else:
|
||||
return tuple(i/inch for i in tupl)
|
||||
|
||||
def Kendall_tau(df):
|
||||
tau = df.corr(method='kendall')
|
||||
@ -82,7 +89,7 @@ def correlation_plot(ax, df='AUC', title='', cbar=False):
|
||||
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.05)
|
||||
cbar_ax.set_title(r'Kendall $\tau$', y=1.02, loc='left')
|
||||
ax.set_title(title)
|
||||
|
||||
def mutation_plot2(ax, model='RS_pramidal'):
|
||||
@ -138,7 +145,7 @@ def mutation_plot2(ax, model='RS_pramidal'):
|
||||
mut_names = AUC.index
|
||||
ax.plot(rheo.loc[mut_names, model_names[mod]], AUC.loc[mut_names, model_names[mod]], linestyle='',
|
||||
markeredgecolor='grey', markerfacecolor='grey', marker=Marker_dict[model_display_names[mod]],
|
||||
markersize=4) # markeredgecolor=clr_dict[model_names[mod]],markerfacecolor=clr_dict[model_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')
|
||||
|
||||
@ -151,9 +158,9 @@ def mutation_plot2(ax, model='RS_pramidal'):
|
||||
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='',
|
||||
markeredgecolor=mut_col[3], markerfacecolor=mut_col[5], marker=Marker_dict[model_display_names[mod]],markersize=4)
|
||||
ax.set_title(model_display_names[mod], fontsize=14)#, color=clr_dict[models[mod]])
|
||||
ax.set_xlabel('$\Delta$ Rheobase (nA)')
|
||||
ax.set_ylabel('$AUC_{contrast}$')
|
||||
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.spines['right'].set_visible(False)
|
||||
ax.spines['top'].set_visible(False)
|
||||
return ax
|
||||
@ -169,19 +176,19 @@ def mutation_legend(ax, marker_s_leg, pos, ncol):
|
||||
E283K = mlines.Line2D([], [], color=colors[2], marker=Markers[2], markersize=marker_s_leg, linestyle='None', label='E283K')
|
||||
V404I = mlines.Line2D([], [], color=colors[5], marker=Markers[3], markersize=marker_s_leg, linestyle='None',
|
||||
label='V404I')
|
||||
WT = mlines.Line2D([], [], color='k', marker='s', markersize=marker_s_leg+5, linestyle='None', label='Wild type')
|
||||
WT = mlines.Line2D([], [], color='k', marker='s', markersize=marker_s_leg+2, linestyle='None', label='Wild type')
|
||||
|
||||
ax.legend(handles=[WT, V174F, F414C, E283K, V404I], loc='center', bbox_to_anchor=pos, ncol=ncol, frameon=False)
|
||||
|
||||
|
||||
|
||||
plot_style()
|
||||
|
||||
# plot_style()
|
||||
sim_style()
|
||||
# plot setup
|
||||
fig = plt.figure(figsize=(18,12))
|
||||
gs0 = fig.add_gridspec(1, 5, wspace=3.5)
|
||||
gsl = gs0[0:3].subgridspec(3, 3, wspace=0.6, hspace=0.6)
|
||||
gsr = gs0[3:5].subgridspec(2, 1, wspace=0.6, hspace=0.8)
|
||||
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)
|
||||
|
||||
ax00 = fig.add_subplot(gsl[0,0])
|
||||
ax01 = fig.add_subplot(gsl[0,1])
|
||||
@ -220,11 +227,15 @@ correlation_plot(axr0,df = 'rheo', title='$\Delta rheobase$', cbar=True)
|
||||
axs = [ax00, ax01,ax02, ax10, ax11, ax12, ax20, ax21, ax22]
|
||||
j=0
|
||||
for i in range(0,9):
|
||||
axs[i].text(-0.28, 1.08, string.ascii_uppercase[i], transform=axs[i].transAxes, size=16, weight='bold')
|
||||
axs[i].text(-0.48, 1.08, 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=16, weight='bold')
|
||||
axr1.text(-0.38, 1.2, string.ascii_uppercase[j+1], transform=axr1.transAxes, size=16, weight='bold')
|
||||
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')
|
||||
|
||||
# save
|
||||
fig.savefig('./Figures/simulation_model_comparison.pdf', bbox_inches='tight')
|
||||
# fig.savefig('./Figures/simulation_model_comparison.pdf') #, bbox_inches='tight'
|
||||
print(fig.dpi)
|
||||
fig.set_size_inches(cm2inch(17.95,15))
|
||||
fig.savefig('./Figures/simulation_model_comparison.pdf', dpi=fig.dpi) #bbox_inches='tight', dpi=fig.dpi
|
||||
plt.show()
|
||||
|
||||
|
50
plotstyle.py
50
plotstyle.py
@ -1,27 +1,59 @@
|
||||
import matplotlib.pyplot as plt
|
||||
|
||||
def plot_style():
|
||||
|
||||
def scheme_style():
|
||||
plt.rcParams['xtick.direction'] = 'out'
|
||||
plt.rcParams['ytick.direction'] = 'out'
|
||||
plt.rcParams['axes.titlesize'] = 20
|
||||
plt.rcParams['axes.labelsize'] = 12
|
||||
plt.rcParams['axes.labelsize'] = 8
|
||||
plt.rcParams['lines.linewidth'] = 2
|
||||
plt.rcParams['lines.markersize'] = 10
|
||||
plt.rcParams['xtick.labelsize'] = 10
|
||||
plt.rcParams['ytick.labelsize'] = 10
|
||||
plt.rcParams['savefig.bbox'] = 'tight'
|
||||
# plt.rcParams['figure.figsize'] = [8.0, 8.0]
|
||||
plt.rcParams['figure.dpi'] = 300
|
||||
|
||||
def boxplot_style():
|
||||
|
||||
def plot_style():
|
||||
plt.rcParams['xtick.direction'] = 'out'
|
||||
plt.rcParams['ytick.direction'] = 'out'
|
||||
plt.rcParams['axes.titlesize'] = 20
|
||||
plt.rcParams['axes.labelsize'] = 12
|
||||
plt.rcParams['lines.linewidth'] = 2
|
||||
plt.rcParams['lines.markersize'] = 1
|
||||
plt.rcParams['lines.markersize'] = 10
|
||||
plt.rcParams['xtick.labelsize'] = 10
|
||||
plt.rcParams['ytick.labelsize'] = 10
|
||||
plt.rcParams['savefig.bbox'] = 'tight'
|
||||
plt.rcParams['axes.titlesize'] = 12
|
||||
plt.rcParams['axes.labelsize'] = 12
|
||||
plt.rcParams['legend.fontsize']=10
|
||||
plt.rcParams['xtick.labelsize'] = 10
|
||||
plt.rcParams['ytick.labelsize']=10
|
||||
plt.rcParams['figure.dpi'] = 300
|
||||
|
||||
def boxplot_style():
|
||||
plt.rcParams['xtick.direction'] = 'out'
|
||||
plt.rcParams['ytick.direction'] = 'out'
|
||||
plt.rcParams['lines.linewidth'] = 1
|
||||
plt.rcParams['lines.markersize'] = 0.5
|
||||
plt.rcParams['xtick.labelsize'] = 4
|
||||
plt.rcParams['ytick.labelsize'] = 4
|
||||
plt.rcParams['savefig.bbox'] = 'tight'
|
||||
plt.rcParams['axes.titlesize'] = 5
|
||||
plt.rcParams['axes.labelsize'] = 4
|
||||
plt.rcParams['legend.fontsize']= 4
|
||||
plt.rcParams['xtick.labelsize'] = 3
|
||||
plt.rcParams['ytick.labelsize']= 3
|
||||
plt.rcParams['mathtext.default'] = 'regular'
|
||||
plt.rcParams['figure.dpi'] = 300
|
||||
|
||||
|
||||
|
||||
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['lines.linewidth'] = 1
|
||||
plt.rcParams['lines.markersize'] = 4
|
||||
plt.rcParams['xtick.labelsize'] = 4
|
||||
plt.rcParams['ytick.labelsize'] = 4
|
||||
plt.rcParams['savefig.bbox'] = 'tight'
|
||||
plt.rcParams.update({'font.size': 4})
|
||||
plt.rcParams['figure.dpi'] = 300
|
Loading…
Reference in New Issue
Block a user