Location: Computational analysis of the human sinus node action potential @ c2034e3322dd / Figure4-plot.py

Author:
Alan Garny <agarny@hellix.com>
Date:
2021-06-16 09:49:10+12:00
Desc:
Don't require Tkinter. This is not needed on macOS (and maybe not on Linux either), but is definitely needed on Windows.
Permanent Source URI:
https://staging.physiomeproject.org/workspace/648/rawfile/c2034e3322dd75a7a15067f35a300bac08101ab9/Figure4-plot.py

import numpy as np
import matplotlib.pyplot as plt
import pandas as pd

# read the csv file extracted from sedml file
data = pd.read_csv('Figure4.csv')

# define the x and y axis and match the units
X1 = data[data.keys()[5]] * 1000
Y1 = data[data.keys()[0]]
Y2 = data[data.keys()[1]]
Y3 = data[data.keys()[2]]
Y4 = data[data.keys()[3]]
Y5 = data[data.keys()[4]]

plt.figure(figsize=(14, 12))

plt.plot(X1, Y1, 'navy', linestyle='-', label='Control', linewidth=3)
plt.plot(X1, Y2, 'red', linestyle='-', label='Block 30%', linewidth=3)
plt.plot(X1, Y3, 'green', linestyle='-', label='Block 70%', linewidth=3)
plt.plot(X1, Y4, 'purple', linestyle='-', label='Block 90%', linewidth=3)
plt.plot(X1, Y5, 'black', linestyle='-', label='Block 100%', linewidth=3)

plt.grid()
plt.xlim(0, 1900)
plt.ylim(-60, 30)
plt.xticks(np.arange(0, 1900, 200))
plt.yticks(np.arange(-60, 35, 10))
plt.xlabel('Time (ms)', fontsize=16)
plt.tick_params(axis='both', labelsize=14)
plt.ylabel('V$_m$ (mV)', fontsize=16)

plt.legend(bbox_to_anchor=(0.3, 0.9, 0.2, 0.07), loc='best', fontsize=14,
           ncol=1, mode="expand", borderaxespad=0.)

plt.tight_layout(pad=0.5, w_pad=3, h_pad=3)
plt.savefig('Figure4.png')
plt.show()