質問
サブプロットコマンドを使用して5 x 3のプロットをプロットしていますが、各サブプロットの周りには大きなマージンがあります。
周囲のマージンサイズを制御するにはどうすればよいですか?
figure;
for c=1:15
subplot(5,3,c);
imagesc(reshape(image(:,c), 360,480));
colormap gray;
axis image;
end
解決
問題は、MATLABが割り当てることです position
各軸のプロパティにより、各プロットの周りにスペースがあります。どちらかを調整できます position
プロパティ、または入手できます サブアキシス ファイル交換から、サブプロットを好きなように設定します。
他のヒント
軸を見てください looseinset と 外部 プロパティ:http://undocumentedmatlab.com/blog/axes-looseinset-property/
MATLAB R2019B以降、使用できます Tiledlayout サブプロットの間隔を制御する機能。
タイル間隔なしでサブプロットを取得する方法を示す例を次に示します。
figure
example_image = imread('cameraman.tif');
t = tiledlayout(5,3);
nexttile
for c= 1:15
imagesc(example_image(:,c))
if c < 15
nexttile
end
end
t.TileSpacing = 'None';
所属していません StackOverflow