Location: Imtiaz_IP3_2002 @ 4624ea7e4bf5 / Simulation / Figure4 / Fig4_plot.py

Author:
Leyla <lnor300>
Date:
2022-11-02 15:31:28+13:00
Desc:
..
Permanent Source URI:
https://models.fieldml.org/workspace/763/rawfile/4624ea7e4bf53d57d1f03fbbc2791d8e953ace0b/Simulation/Figure4/Fig4_plot.py

import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
prefilename = 'Fig4_A'
filename = '%s.csv' % prefilename 
data = pd.read_csv(filename)

time = data['time']
vm = data['Vm']
ca_y = data['y']
p_ip3 = data['ip3']
ca_z = data['z']

fig = plt.figure(figsize=(10, 6),  edgecolor='k')
axs = fig.subplots(2)
# fig, axs = plt.subplots(2)
fig.subplots_adjust(top=0.85)
# Add the original data extracted from primary paper
origin_data = 1
if origin_data == 1:
        filename = 'Figure_4_origin.csv'
        data1 = pd.read_csv(filename)
        y_d = data1 [ 'Curve1' ]
        x_d = data1 [ 'x' ]
        axs[0].plot( x_d,y_d, '.r')

axs[0].set_title('Slow wave voltage dependence on injected current')
axs[0].plot(time, vm, 'k')
axs[0].set_ylabel('Membrane Voltage [mV]', fontsize=12)
axs[0].set_xticks([])
axs[0].axis([-2, 36, -90, -20])
axs[1].set_xlabel('Time [min]', fontsize=12)
axs[1].text(0.23, 0.5, ' $I_{inj} = 0 mA$',
        verticalalignment='bottom', horizontalalignment='right',
        transform=axs[1].transAxes,
        color='k', fontsize=12)

axs[1].text(0.56, 0.17, ' $I_{inj} = -15 mA$',
        verticalalignment='bottom', horizontalalignment='right',
        transform=axs[1].transAxes,
        color='k', fontsize=12)

axs[1].text(0.9, 0.99, ' $I_{inj} = +22 mA$',
        verticalalignment='bottom', horizontalalignment='right',
        transform=axs[1].transAxes,
        color='k', fontsize=12)

bottom_side = axs[0]. spines["bottom"]
bottom_side. set_visible(False)
axs[1].plot(time[0:1200], np.ones(1200)*0, 'k', time[1200:2401], np.ones(1201)*-15, 'k', time[2401: 3602], np.ones(1200)*20, 'k')
axs[1].set_ylabel('Current [mA]', fontsize=12)
axs[1].set_xlabel('Time [min]', fontsize=12)
axs[1].axis([0, 36, -17,23])
top_side = axs[1]. spines["top"]
top_side. set_visible(False)
plt.show()
plt.savefig('Figure_4B')