- Author:
- Leyla <noroozbabaee@gmail.com>
- Date:
- 2022-01-13 15:37:43+13:00
- Desc:
- Adding extracted data from original paper.
- Permanent Source URI:
- https://staging.physiomeproject.org/workspace/762/rawfile/c2da3f0944c096d4906eb5166278cc20e9b2ebe2/Simulations/Plot_Fig3_Ano1.py
# Author: Leyla Noroozbabaee
# Date: 12/09/2021
# To reproduce Figure 3 from original paper, the python file 'IAo1.py' should be run.
import matplotlib.pyplot as plt
import pandas as pd
# Figure name
figfile = 'Fig3'
# Read data from the files
x_name = 'Time'
y_name = [ 'IAon1']
current = r'$I_{Aon1}(pA)$'
print(current)
y_labels = [ '%s' % current ]
Vm = range(-100, 140, 40)
suffix = [ 'h', 'g', 'f', 'e', 'd', 'c', 'b', 'a' ]
c = ['a','b','c','d']
# Set figure dimension (width, height) in inches.
fw, fh = 15, 6
# Set subplots
subpRow, subpCol = 1, 4
ax, lns = {}, {}
# Set Title
tit = ['A $Ca_{Aon1}$ =$10^{-7}$ M','B $Ca_{Aon1}$ = $10^{-6}$ M','C $Ca_{Aon1}$ = $10^{-5}$ M','D']
# This gives list with the colors from the cycle, which you can use to iterate over.
cycle = plt.rcParams [ 'axes.prop_cycle' ].by_key() [ 'color' ]
# Set subplots
lfontsize, labelfontsize = 10, 15 # legend, label fontsize
fig, axs = plt.subplots(subpRow, subpCol, figsize=(fw, fh), facecolor='w', edgecolor='k')
fig.subplots_adjust(hspace = .1, wspace=.1)
for j in range(4):
for i, V in enumerate(Vm):
filename = '%s_%d_%s.csv' % (figfile, i, c [ j ])
print('filename', filename)
data = pd.read_csv(filename)
x_data = data [ x_name ]
y_data = data [ y_name ]
filename = '%d_%s.csv' % ( i, c [ j ])
print('filename', filename,j)
# To add the extracted data from original paper to your plot, modify the path to have access to the
# "Fig3_extracted_data" folder.
data = pd.read_csv(filename)
y_d = data [ 'Curve1' ]
x_d = data ['x' ]
axs [ j ].plot(x_data, y_data, color=cycle [ i % 7 ], label='%d mV ' % (V))
axs [ j ].plot(x_d, y_d, 'k*')
plt.tick_params(direction='in', axis='both')
axs [ j ].set_xlabel('Time (ms)', fontsize=labelfontsize)
axs [ j ].set_title('%s' % (tit[j]))
if j==3:
axs [ j ].axis([ 0, 20, -40, 60 ])
print('No-legend')
else:
axs [ j ].axis([ 0,15, -50, 50 ])
axs [ 0 ].legend(loc='best', fontsize=lfontsize, frameon=False)
axs [ 0 ].set_ylabel(y_labels [ 0 ], fontsize=labelfontsize)
figfiles = '%s.png' % figfile
plt.savefig(figfiles)
plt.show()