How can I change the distance between figures in subplot?

20 views (last 30 days)
Dear All,
I created a subplot figure with the following code:
subplot(2,2,1);
axesm('lambert','maplatlimit',[ 26.5861 71.8699],'maplonlimit',[-34.748 60.8422]);
>> pcolorm(lat,lon,IU1);
set(gca,'box','off')
set(gca,'visible','off')
set(gcf,'resize','on');
>> colormap(C);
subplot(2,2,2);
axesm('lambert','maplatlimit',[ 26.5861 71.8699],'maplonlimit',[-34.748 60.8422]);
>> pcolorm(lat,lon,IU2);
set(gca,'box','off')
set(gca,'visible','off')
set(gcf,'resize','on');
>> colormap(C);
subplot(2,2,3);
axesm('lambert','maplatlimit',[ 26.5861 71.8699],'maplonlimit',[-34.748 60.8422]);
>> pcolorm(lat,lon,IU3);
set(gca,'box','off')
set(gca,'visible','off')
set(gcf,'resize','on');
>> colormap(C);
subplot(2,2,4);
axesm('lambert','maplatlimit',[ 26.5861 71.8699],'maplonlimit',[-34.748 60.8422]);
>> pcolorm(lat,lon,IU4);
set(gca,'box','off')
set(gca,'visible','off')
set(gcf,'resize','on');
>> colormap(C);
hp4 = get(subplot(2,2,4),'Position')
>> h=colorbar;
set(h, 'Position', [hp4(1)+hp4(3)+0.02 hp4(2) 0.01 hp4(2)+hp4(3)*2.1],'YTickMode', 'manual', 'YTick',[1,2,3,4,5], 'YTickLabelMode', 'manual', 'YTickLabel', {'Hiper-arid', 'Arid', 'Semi-arid', 'Sub-humid', 'Humid'},'FontSize',12, 'FontWeight', 'bold');
I delted the box with
set(gca,'box','off')
because the Lambert projection created a too big box compare to the figure. In the resulted figure (is attached)the distance between subplot(2,2,1) and subplot(2,2,2) is too large. Could someone suggest me a solution for mitigate the distance? Thank you for your help in advance!

Answers (1)

Ingrid
Ingrid on 3 Feb 2016
Edited: Ingrid on 3 Feb 2016
is use this submission from the file exchange
but there are many others there that can do what you want, just search for subpot in the file exchange and read the short description to see which one best fits your needs

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!