Location: Blood HbO2 and HbCO2 Dissociation Curves @ f725b6864f22 / Figure02_plot.py

Author:
nima <nafs080@aucklanduni.ac.nz>
Date:
2020-10-29 09:32:37+13:00
Desc:
All the Cellml files, Sedml files and python scripts for figures are added
Permanent Source URI:
https://models.cellml.org/workspace/607/rawfile/f725b6864f22a00138a2c2455308142c8baba373/Figure02_plot.py

import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
from scipy import interpolate
import math
import sys
# import plot_func

# reload (plot_func)
import os


data1 = pd.read_csv('n1.csv')
data2 = pd.read_csv('n2.csv')
data3 = pd.read_csv('n3.csv')
data4 = pd.read_csv('n4.csv')
x1_name = "main/pH"
y1_name = "main/n1"
#
x2_name = "main/pCO2"
y2_name = "main/n2"
#
x3_name = "main/DPG"
y3_name = "main/n3"

x4_name = "main/Temp"
y4_name = "main/n4"


X1 = data1[x1_name]
Y1 = data1[y1_name]

X2 = data2[x2_name]
Y2 = data2[y2_name]
#
X3 = data3[x3_name]*1000
Y3 = data3[y3_name]
#
X4 = data4[x4_name]
Y4 = data4[y4_name]

# Y_values = []
plt.figure(figsize=(14,10))
plt.subplot(2,2,1)

plt.plot(X1, Y1, 'navy' ,linestyle='-',marker = 's', linewidth=3)


plt.xlim(6.67,7.65)
plt.ylim(1, 1.10)
# plt.yticks(np.arange(0,0.8,0.15))
plt.xticks(np.arange(6.68,7.65,0.12))
plt.ylabel ('n$_1$',fontsize=14)
plt.xlabel ('pH$_{rbc}$',fontsize=14)
plt.grid()
plt.subplots_adjust(bottom=0.5, right=0.8, top=1)
plt.tight_layout(pad=0.4, w_pad=0.5, h_pad=1.0)
plt.title('A')
# plt.legend(loc='upper left')

#######
# #
plt.subplot(2,2,2)

plt.plot(X2, Y2, 'navy' ,linestyle='-',marker = 's', linewidth=3)


plt.xlim(0,120)
plt.ylim(0, 0.3)
# plt.yticks(np.arange(0,0.8,0.15))
plt.xticks(np.arange(0,121,20))
plt.ylabel ('n$_2$',fontsize=14)
plt.xlabel ('P$_{CO_2}$(mmHg)',fontsize=14)
plt.grid()
plt.subplots_adjust(bottom=0.5, right=0.8, top=1)
plt.tight_layout(pad=0.4, w_pad=0.5, h_pad=1.0)
plt.title('B')
# plt.legend(loc='upper left')
# #
# # #######
plt.subplot(2,2,3)

plt.plot(X3, Y3, 'navy' ,linestyle='-',marker = 's', linewidth=3)


plt.xlim(2.9,10.3)
plt.ylim(0.3, 0.5)
# plt.yticks(np.arange(0,0.8,0.15))
plt.xticks(np.arange(3.0,10.3,1.2))
plt.ylabel ('n$_3$',fontsize=14)
plt.xlabel ('DPG$_{rbc}$',fontsize=14)
plt.grid()
plt.subplots_adjust(bottom=0.5, right=0.8, top=1)
plt.tight_layout(pad=0.4, w_pad=0.5, h_pad=1.0)
plt.title('C')
# plt.legend(loc='upper left')
# # #######
plt.subplot(2,2,4)

plt.plot(X4, Y4, 'navy' ,linestyle='-',marker = 's', linewidth=3)

plt.xlim(20,50.1)
plt.ylim(3, 6)
# plt.yticks(np.arange(3,6,15))
plt.xticks(np.arange(20,50.1,5))
plt.ylabel ('n$_4$',fontsize=14)
plt.xlabel ('T, $^\circ$C  ',fontsize=14)
plt.grid()
plt.subplots_adjust(bottom=0.5, right=0.8, top=1)
plt.tight_layout(pad=0.4, w_pad=0.5, h_pad=1.0)
plt.title('D')
# plt.legend(loc='upper left')
# # #######
# #
plt.savefig('Figure02.png')
plt.show()