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

猜你喜欢

转载自blog.csdn.net/qq_43445577/article/details/109604574