matlab去除繪圖白邊


去除白邊

set(gca,'LooseInset',get(gca,'TightInset'))

set(gca, 'LooseInset', [0,0,0,0]);

但發現有時直接選擇圖片充滿窗口時,有一部分圖的右側邊框會被覆蓋到。這時可以調整一下以上兩條命令的位置,把set(gca,'LooseInset',get(gca,'TightInset'))放在figure命令后。

figure
%set(gca, 'LooseInset', [0,0,0,0]);
set(gca,'LooseInset',get(gca,'TightInset'))
plot(linspace(0, 300, 38144), acc_1(:, 6)*g)
xlabel('Time(s)')
ylabel('Acceleration(m/s^2)')

  

 

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

matlab調整繪圖的邊緣空白尺寸

matlab出圖時邊緣會有白邊,為了插入文章后的美觀,需要進行調整白邊尺寸。

一種簡單的方式是可以直接在figure窗口配置導出參數,但發現有時直接選擇圖片充滿窗口時,有一部分圖的邊框會被覆蓋到。此時,可通過下面的代碼對上下左右的白邊尺寸進行微調。

ax = gca;
outerpos = ax.OuterPosition; % [0, 0, 1, 1]

ti = ax.TightInset; 
left = outerpos(1) + ti(1);
bottom = outerpos(2) + ti(2);
ax_width = outerpos(3) - ti(1) - ti(3);
ax_height = outerpos(4) - ti(2) - ti(4);
ax.Position = [left bottom ax_width ax_height];

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM