天天看點

matlab繪圖常用指令繪圖格式設定在圖中添加内容畫大圖

繪圖格式設定

set(gca,'XLim',[0 800]);%X軸的資料顯示範圍
set(gca,'XTick',[0:100:800]);%設定要顯示坐标刻度
set(gca,'YLim',[-2 2]);%X軸的資料顯示範圍
set(gca,'YTick',[-2:1:2]);%設定要顯示坐标刻度
set(gcf,'Position',[100,100,640,480]);%設定圖檔産生位置和大小
set(gca,'FontName','Times New Roman','FontSize',15,'FontWeight','bold','LineWidth',1.5);%全局設定
           

在圖中添加内容

xlabel('BIN Width(ps)'); %x軸
ylabel('Count');%y軸
legend(['\Delta T Vs.\Deltaenergy'],['Time Walk Correction Approximated Line : ','y','=',num2str(k),'x',num2str(b),'  R^2=',num2str(R(1,2))]);%圖例
title({['difference between ideal BIN and OC',num2str(5*i+28)];['RMS=',num2str(RMS),'    AVER=',num2str(AVER)]});%标題
gtext({['STD: ',num2str(std(TDC_40_OC_BIN)),' ps'];['Mean: ',num2str(mean(TDC_40_OC_BIN)),' ps']},'FontName','Times New Roman','FontSize',26,'FontWeight','bold');%添加文本
           

畫大圖

fig0=figure('units','normalized','outerposition',[0.04 0.04 0.94 0.90]);
for ch = 1:ch_num
	figure(fig0);
    subplot(4,4,ch);
    plot(edge_value_result(:,1:7));
    title(['TDC,',num2str(ch)]);
    xlim([0 760]);ylim([0 2500]);
    ylabel('Time(ps)');
    xlabel('Number of edge values');
end