% Multiple plots using setPlotProp. Sets color, legend, line style, tick % etc. clear all; %addpath('../lib'); data1= dlmread('Fig3(a).txt','',1,0); data2= dlmread('Fig3(b).txt','',1,0); data3= dlmread('Fig3(c).txt','',1,0); data4= dlmread('Fig3(d).txt','',1,0); %% figure; %Plot figure 3(a) plot(data1(:,1),data1(:,2),data1(:,1),data1(:,3),data1(:,1),data1(:,4),data1(:,1),data1(:,5), ... data1(:,1),data1(:,6)); ax = gca; ax.XAxis.TickLabelFormat = '%,.1f'; ax.YAxis.TickLabelFormat = '%,.2f'; %% change properties opt.BoxDim=[4.2,3]; opt.XLabel = '\it{r}/\sigma'; % xlabel opt.YLabel = '\langle\it{U^{tot}_{N}-U^{tot}_{\infty,N}}\rangle\it{/k_{B}T^{exp}}'; %ylabel opt.YTick = [-1.25, -1.00, -0.75, -0.50, -0.25, 0]; %[tick1, tick2, .. ] opt.XLim = [1, 3]; % [min, max] opt.YLim = [-1.25, 0]; % [min, max] opt.XMinorTick='off'; opt.YMinorTick='off'; opt.Colors = [ % set color for data plot 1,0,0; 1,0,0; 0,0,0; 0, 0, 0; 0, 0, 1; 0,0,1; ]; opt.LineWidth = [1.5, 1.5, 1.5]; % three line widths opt.LineStyle = {'-', '--','-', '--','-', '--'}; % three line styles %opt.Legend = {'\theta = 90^o', '\theta = 60^o', '\theta = 54.7^o', ... %'\theta = 53^o', '\theta = 52^o', '\theta = 40^o','\theta = 0^o'}; % legends % Save? comment the following line if you do not want to save opt.FileName = 'Figure3(a).png'; % create the plot setPlotProp(opt); %% figure; %plot figure 3(b) plot(data2(:,1),data2(:,2),data2(:,1),data2(:,3),data2(:,1),data2(:,4)); ax = gca; ax.XAxis.TickLabelFormat = '%,.1f'; ax.YAxis.TickLabelFormat = '%,.2f'; %% change properties opt.BoxDim=[4.2,3]; opt.XLabel = '\it{r}/\sigma'; % xlabel opt.YLabel = '\it{-\DeltaU^{tot}/}\langle\it{U^{tot}_{0,2}}\rangle'; %ylabel opt.YTick = [-0.2, -0.15, -0.1, -0.05, 0, 0.05, 0.1]; %[tick1, tick2, .. ] opt.XLim = [1, 3]; % [min, max] opt.YLim = [-0.2, 0.12]; % [min, max] opt.XMinorTick='off'; opt.YMinorTick='off'; opt.Colors = [ % set color for data plot 1,0,0; 0,0,0 0,0,1 ]; opt.LineWidth = [1.5, 1.5, 1.5]; % three line widths opt.LineStyle = {'-', '-', '-'}; % three line styles opt.Legend = {'L', 'T', 'B'}; % legends % Save? comment the following line if you do not want to save opt.FileName = 'Figure3(b).png'; % create the plot setPlotProp(opt); %% figure; %plot figure 3(b) plot(data3(:,1),data3(:,2),data3(:,1),data3(:,3),data3(:,1),data3(:,4),data3(:,1),data3(:,5), ... data3(:,1),data3(:,6),data3(:,1),data3(:,7),data3(:,1),data3(:,8),data3(:,1),data3(:,9)); ax = gca; ax.XAxis.TickLabelFormat = '%,.1f'; ax.YAxis.TickLabelFormat = '%,.2f'; %% change properties opt.BoxDim=[4.2,3]; opt.XLabel = '\it{r}/\sigma'; % xlabel opt.YLabel = '\langle\it{U^{tot}_{N}-U^{tot}_{\infty,N}}\rangle\it{/k_{B}T^{exp}}'; %ylabel opt.YTick = [-1.5, -1, -0.5, 0, 0.5, 1]; %[tick1, tick2, .. ] opt.XLim = [1, 3]; % [min, max] opt.YLim = [-1.5, 1]; % [min, max] opt.XMinorTick='off'; opt.YMinorTick='off'; opt.Colors = [ % set color for data plot 1,0,0; 0,1,0; 0,0,1; 0,0,0; 1,0,0; 0,1,0; 0,0,1; 0,0,0; ]; opt.LineWidth = [1.5, 1.5, 1.5]; % three line widths opt.LineStyle = {'--', '--', '--','--','-','-','-','-'}; % three line styles opt = rmfield(opt,'Legend'); % Save? comment the following line if you do not want to save opt.FileName = 'Figure3(c).png'; % create the plot setPlotProp(opt); %% figure; %plot figure 3(b) plot(data4(:,1),data4(:,2),data4(:,1),data4(:,3),data4(:,1),data4(:,4),data4(:,1),data4(:,5), ... data4(:,1),data4(:,6),data4(:,1),data4(:,7),data4(:,1),data4(:,8),data4(:,1),data4(:,9)); ax = gca; ax.XAxis.TickLabelFormat = '%,.1f'; ax.YAxis.TickLabelFormat = '%,.2f'; %% change properties opt.BoxDim=[4.2,3]; opt.XLabel = '\it{r}/\sigma'; % xlabel opt.YLabel = '\langle\it{U^{tot}_{N}-U^{tot}_{\infty,N}}\rangle\it{/k_{B}T^{exp}}'; %ylabel opt.YTick = [-1.5, -1, -0.5, 0, 0.5]; %[tick1, tick2, .. ] opt.XLim = [1, 3]; % [min, max] opt.YLim = [-1.8, 0.5]; % [min, max] opt.XMinorTick='off'; opt.YMinorTick='off'; opt.Colors = [ % set color for data plot 1,0,0; 0,1,0; 0,0,1; 0,0,0; 1,0,0; 0,1,0; 0,0,1; 0,0,0; ]; opt.LineWidth = [1.5, 1.5, 1.5]; % three line widths opt.LineStyle = {'--', '--', '--','--','-','-','-','-'}; % three line styles %opt = rmfield(opt,'Legend'); % Save? comment the following line if you do not want to save opt.FileName = 'Figure3(d).png'; % create the plot setPlotProp(opt);