# -*- coding: utf-8 -*-
"""
Created on Sun Mar 6 14:41:05 2022
@author: cyb20176
"""
#%%
import numpy as np
import matplotlib.pyplot as plt
# create fake data
a=b= np.arange(0,3,.02)
c=np.exp(a)
#%%
d= c[::-1]
fig,ax=plt.subplots()
ax.plot(a,c,'k--',label= 'Ground Truth')
ax.plot(a,d,'k:',label='Recoverd decay')
ax.plot(a,c+d,'k',label='Noise decay')
# legend=ax.legend(loc='upper center',shadow=True,fontsize='x-large')
legend=ax.legend(loc='best')
legend.get_frame().set_facecolor('green')
image.png
My project
# -*- coding: utf-8 -*-
"""
Created on Fri Mar 4 10:58:47 2022
@author: cyb20176
"""
#%%
import scipy.io as scio
import matplotlib.pyplot as plt
datapath_GT= r'ground_truth_decay.mat'
data_GT= scio.loadmat(datapath_GT)
datapath_Recover= r'recoverd_decay.mat'
data_Recover= scio.loadmat(datapath_Recover)
datapath_noise= r'noise_decay.mat'
data_noise= scio.loadmat(datapath_noise)
# # print(data)
indata_GT = data_GT['yt']
# indata = indata.astype('float')
indata_Recover= data_Recover['y_auto_bi_sigma0']
indata_noise= data_noise['y']
# #%%
# plt.plot(indata_GT[2000,:],color='r',linewidth=2,linestyle='--')
# # plt.legend('GT')
# plt.legend(labels=['Ground Truth'],loc='best')
# plt.plot(indata_Recover[2000,:],color='b',linewidth=2,linestyle='solid')
# # plt.legend('GT')
# plt.legend(labels=['Recoverd decay'],loc='best')
#%%
fig,ax=plt.subplots()
ax.plot(indata_GT[2000,:],'k--',linewidth=2,label= 'Ground Truth')
ax.plot(indata_Recover[2000,:],'r',linewidth=2,label='Recoverd decay')
ax.plot(indata_noise[2000,:],'k',linewidth=2,label='Noise decay')
# legend=ax.legend(loc='upper center',shadow=True,fontsize='x-large')
legend=ax.legend(loc='best')
legend.get_frame().set_facecolor('green')
ax.set_xlabel('Time bin')
ax.set_ylabel('Normlized intensity (a.u.)')
image.png