# Author: Leyla Noroozbabaee # Date: 12/12/2021 # To reproduce Figure 6 from original paper, the python file 'Fig6_sim.py' should be run. import matplotlib.pyplot as plt import pandas as pd from sklearn import preprocessing import numpy as np # Figure name prefilename = 'Fig11' figfile = 'Figure_12_origin' # Read data from the files # x_name = 'Time' # y_name = 'fss' # z_name = ['I_inj'] # current = r'$I_{Aon1}(pA)$' # print(current) # y_labels = [ '%s' % current ] suffix = [ 'h', 'g', 'f', 'e', 'd', 'c', 'b', 'a' ] c = ['a','b','c','d'] # Set figure dimension (width, height) in inches. fw, fh = 15, 10 # Set subplots subpRow, subpCol = 3, 2 ax, lns = {}, {} # Set Title tit = ['1s','2 s','1s','2 s','1s','2 s'] # 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) axs = axs.ravel() var_name = ['Time','Force', 'I_tot', 'v', 'cai'] # y_name =['fss']; x_base =[0.4, 0.6] sub = ['A','B','C','D'] I_st =[ -0.18, -0.13, -0.1, -0.5] for i in range(len(I_st)): filename = '%s_%s.csv' % (prefilename, sub[i]) data = pd.read_csv(filename) time = data [ var_name[0] ] Force_data = data [var_name[1]] I_tot_data = data [var_name[2]] v_data = data [var_name[3]] cai_data = data [var_name[4]] # axs[0].plot( time, Force_data, 'b') # axs[1].plot( time, I_tot_data, 'b') axs[i].plot( time, v_data, color=cycle [ i %5 ])# y_data = data [ var [ i ] ] # axs[3].plot( time, cai_data, 'b') plt.show() # import numpy as np # import matplotlib.pyplot as plt # # def SquareWave(n,xmin=0,xmax=35,ymin=0,Nx=1000,ymax=2,offset=2): # # # x = np.sort(np.concatenate([np.arange(xmin, xmax)-1E-6,np.arange(xmin, xmax)+1E-6])) # #You can use np.linspace(xmin,xmax,Nx) if you want the intermediate points # y=np.array(x+n+offset,dtype=int)%2 # # plt.plot(x, y) # plt.axis([xmin, xmax, ymin, ymax]) # # plt.grid() # plt.show() # SquareWave(0, xmin=0, xmax=10, ymin=0, Nx=1000, ymax=2, offset=1)