0.6, 0.63, 0.66, 0, 0.68, 0.8, 0.75, 0.61, 0.69, 0.8, 0.8, 0.8 ] [ ax.axvline(pn.find_local_max(interm2_syn)[1][i], ymin=0, ymax=lengthOftheLine[i], color='k', ls=':') for i in num_of_peak_showed ] #add names of the peaks position_y = [0.12, 0.15, 0.2, 1.1, 0.2, 0.33, 0.25, 0.14, 0.22] [ text(pn.find_local_max(interm2_syn)[1][i], position_y[i], pn.name_of_the_peak(interm2_syn)[i], horizontalalignment='center', verticalalignment='bottom', fontsize=14, rotation=80) for i in num_of_peak_showed ] xlim(0.8, 7) ylim(-0.5, 0.5) xlabel(r'r ($\AA$)') ylabel(r'G(r) ($\AA^{-2}$)') legend(loc=4, fontsize='small', ncol=1, columnspacing=0.5, labelspacing=0,
def plot(): # start plotting close('all') f, ax0 = subplots(figsize=(6, 4.5)) subplots_adjust(left=0.15, bottom=0.16) # text(0.05, 0.9, target.__name__, transform=ax0.transAxes) # no normalization # [ax0.plot(interm2_syn[i][0],np.array(interm2_syn[i][1]), alpha=1,label='%s'%(name_of_the_plot[i])) for i in range (np.shape(data_files_1)[0])] # with normalization [ ax0.plot(interm2_syn[i][0], np.array(interm2_syn[i][1]) * norm_factor_wrt_first_curve[i], alpha=1, label='%s' % (name_of_the_plot[i]), color=line_color[i + interval - 5]) for i in range(np.shape(data_files_1)[0]) ] #add vertical lines at the local max # num_of_peak_showed = [0,2,5] num_of_peak_showed = arange(9) num_of_peak_showed = append(num_of_peak_showed, [-3, -2, -1]) lengthOftheLine = [ 0.85, 0.3, 0.66, 0.4, 0.61, 0.8, 0.6, 0.55, 0.6, 0.8, 0.8, 0.8 ] [ ax0.axvline(pn.find_local_max(interm2_syn)[1][i], ymin=0, ymax=lengthOftheLine[i], color='k', ls=':') for i in num_of_peak_showed ] #add names of the peaks position_y = [3.2, -0.8, 1.8, 0, 1.5, 2.7, 1.5, 1, 1.5] [ text(pn.find_local_max(interm2_syn)[1][i], position_y[i], pn.name_of_the_peak(interm2_syn)[i], horizontalalignment='center', verticalalignment='bottom', fontsize=14, rotation=80) for i in num_of_peak_showed ] #increase the freq of the ticks locator_params(axis='x', tight=True, nbins=10) xlim(0.8, 6) # ylim (-0.4,0.4) #ax.axhline(y=0, color='k') ylabel('G(r) ($\AA^{-2}$)') xlabel(r'r ($\AA$)') legend(loc=4, fontsize='small', ncol=1, columnspacing=0.5, labelspacing=0, frameon=True) f.show()
import peak_assign as pn close("all") f, ax = subplots(figsize=(20,6)) <<<<<<< HEAD name_of_the_plot_nc=['%s h'%(array(nonano.x_value(nonano.Readfile)[i])) for i in range (shape(nonano.x_value(nonano.Readfile))[0])] name_of_the_plot_nnc=['%s h'%(array(nnc.x_value(nnc.Readfile)[i])) for i in range (shape(nnc.x_value(nnc.Readfile))[0])] ======= name_of_the_plot_nc=['%s h'%(array(nonano.x_value()[i])) for i in range (shape(nonano.x_value())[0])] name_of_the_plot_nnc=['%s h'%(array(nnc.x_value()[i])) for i in range (shape(nnc.x_value())[0])] >>>>>>> 4fd4d8775961b746663b468da51d99862c5c9d2e [ax.plot(nonano.curve()[i][0],(np.array(nonano.curve()[i][1])-array(nonano.curve()[0][1]))*10 , '-',alpha=1,label='no nano, %s - 0 h'%(name_of_the_plot_nc[i])) for i in nonano.Readfile()[2]] [ax.plot(nnc.curve()[i][0],(np.array(nnc.curve()[i][1])-array(nnc.curve()[0][1]))*10 + 5, '--',linewidth=1.5,alpha=1,label='nano, %s - 4.35 h'%(name_of_the_plot_nnc[i])) for i in nnc.Readfile()[2]] legend(loc=0, fontsize ='small',ncol=2,columnspacing=0.5, labelspacing=0) #add vertical lines at the local max i_range = [0, 2, 5, 8] lengthOftheLine = [0.92,0.9,0.9,0.9,0.9,0.9,0.8,0.8,0.9,0.9] [ax.axvline(pn.find_local_max(nonano.curve())[1][i],ymin=0,ymax=lengthOftheLine[i],color='k') for i in i_range] #add names of the peaks position_y = [3.5,1,2.5 ,2.5, 3, 3,2,2.7,3.5] [text(pn.find_local_max(nonano.curve())[1][i],position_y[i], pn.name_of_the_peak(nonano.curve())[i],horizontalalignment='center',fontsize=14) for i in i_range] f.show() # f.savefig('/Users/hty/desktop/diff pdf compare %s.pdf'%('full range'))
def difference_plot(gs0, gs1, title_text=''): # f, ax = subplots(nrows=2, ncols=1, sharex=True, figsize=(7,7)) ax0 = subplot(gs0) text(0.1, 4.5, title_text) [ ax0.plot(interm2_syn[i][0], np.array(interm2_syn[i][1]) * norm_factor_wrt_first_curve[i], alpha=1, label='%s' % (name_of_the_plot[i]), color=line_color[i + interval - 4]) for i in range(np.shape(data_files_1)[0]) ] # [ax.plot(interm2_syn[i][0],np.array(interm2_syn[i][1])*norm_factor_wrt_first_curve[i], alpha=1,label='%s'%(name_of_the_plot[i])) for i in range (np.shape(data_files_1)[0])] #add vertical lines at the local max # num_of_peak_showed = [0,2,5] num_of_peak_showed = arange(9) # num_of_peak_showed = append(num_of_peak_showed, [-3, -2, -1]) lengthOftheLine = [ 0.85, 0.3, 0.66, 0.55, 0.61, 0.8, 0.6, 0.55, 0.6, 0.8, 0.8, 0.8 ] [ ax0.axvline(pn.find_local_max(interm2_syn)[1][i], ymin=0, ymax=lengthOftheLine[i], color='k', ls=':') for i in num_of_peak_showed ] #add names of the peaks position_y = [3.2, -0.8, 1.8, 1, 1.5, 2.7, 1.5, 1, 1.5] [ text(pn.find_local_max(interm2_syn)[1][i], position_y[i], pn.name_of_the_peak(interm2_syn)[i], horizontalalignment='center', verticalalignment='bottom', fontsize=14, rotation=80) for i in num_of_peak_showed ] #increase the freq of the ticks locator_params(axis='x', tight=True, nbins=10) xlim(0.8, 6) ylim(-3, 4) #ax.axhline(y=0, color='k') ylabel('G(r) ($\AA^{-2}$)') Legend = ax0.legend(loc=4, fontsize='small', ncol=2, columnspacing=0.5, labelspacing=0, frameon=True, title='Drying time') setp(Legend.get_title(), fontsize='small') '''difference plots''' ax1 = subplot(gs1) mag_factor = 1 # text(0.1, 0.5, '(b)') line_type = ['-', '-', '--', '-'] marker_type = ['', '', '', ''] line_width = [1, 1, 1.5, 2] [ ax1.plot( interm2_syn[i][0], (np.array(interm2_syn[i][1]) * norm_factor_wrt_first_curve[i] - array(interm2_syn[0][1])), linestyle=line_type[i], linewidth=line_width[i], alpha=1, label='%s - %s' % (name_of_the_plot[i], name_of_the_plot[0]), color=line_color[i + interval - 5]) for i in range(np.shape(data_files_1)[0])[1:] ] #difference plots # [ax.plot(interm2_syn[i][0],(np.array(interm2_syn[i][1])*norm_factor_wrt_first_curve[i]-array(interm2_syn[0][1]))*5 + 6, '--', alpha=1,label='%s - %s'%(name_of_the_plot[i], name_of_the_plot[0])) for i in range (np.shape(data_files_1)[0])] # [ax.plot(interm2_syn[i][0],(np.array(interm2_syn[i][1])-array(interm2_syn[0][1]))*5 + 10, '--', linewidth=1.5,alpha=1,label='%s - 0h no norm.'%(name_of_the_plot[i])) for i in range (np.shape(data_files_1)[0])] locator_params(axis='x', tight=True, nbins=10) xlabel(r'r ($\AA$)') xlim(0.8, 6) ylim(-0.6, 0.5) # text(5,7.5,'x 5') legend(loc=4, fontsize='small', ncol=2, columnspacing=0.5, labelspacing=0, frameon=True) title('Difference', fontsize='small') return target.__name__