How can I set subplot size in MATLAB figure?

前端 未结 4 1179
余生分开走
余生分开走 2021-02-04 16:11

I often need to plot 10 images together, but using this code results in small images :

img = rand(400,600); 
for i=1:10
 subplot(2,5,i); 
 imshow(img); 
 title(         


        
4条回答
  •  甜味超标
    2021-02-04 16:48

    I have this requirement often and the most efficient way for me to achieve it is using the third party subplot_tight function, which is a more-or-less slot-in replacement for subplot. At its simplest you can do

    figure(1); clf
    subplot_tight(1,2,1, [0.05 0.05])
    %normal plot stuff
    

    where the two parameters in the fourth argument control the fraction of visible space around the image.

提交回复
热议问题