日韩av黄I国产麻豆传媒I国产91av视频在线观看I日韩一区二区三区在线看I美女国产在线I麻豆视频国产在线观看I成人黄色短片

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 >

matlab绘图白边设定

發布時間:2024/7/23 37 豆豆
生活随笔 收集整理的這篇文章主要介紹了 matlab绘图白边设定 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

最好提前設定好paper大小!
對于一個坐標軸,用下面這句即可:

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

對于subplot,利用該函數

function [] = RemoveSubplotWhiteArea(gca, sub_row, sub_col, current_row, current_col) % 設置OuterPosition sub_axes_x = current_col*1/sub_col - 1/sub_col; sub_axes_y = 1-current_row*1/sub_row; % y是從上往下的 sub_axes_w = 1/sub_col; sub_axes_h = 1/sub_row; set(gca, 'OuterPosition', [sub_axes_x, sub_axes_y, sub_axes_w, sub_axes_h]); % 重設OuterPosition% TightInset的位置 inset_vectior = get(gca, 'TightInset'); inset_x = inset_vectior(1); inset_y = inset_vectior(2); inset_w = inset_vectior(3); inset_h = inset_vectior(4);% OuterPosition的位置 outer_vector = get(gca, 'OuterPosition'); pos_new_x = outer_vector(1) + inset_x; % 將Position的原點移到到TightInset的原點 pos_new_y = outer_vector(2) + inset_y; pos_new_w = outer_vector(3) - inset_w - inset_x; % 重設Position的寬 pos_new_h = outer_vector(4) - inset_h - inset_y; % 重設Position的高% 重設Position set(gca, 'Position', [pos_new_x, pos_new_y, pos_new_w, pos_new_h]);

舉例:
subplot(2,1,1)

RemoveSubplotWhiteArea(gca, 2, 1, 1, 1)
subplot(2,1,2)

RemoveSubplotWhiteArea(gca, 2, 1, 2, 1)

總結

以上是生活随笔為你收集整理的matlab绘图白边设定的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。