worldmap space between subplots
    3 Ansichten (letzte 30 Tage)
  
       Ältere Kommentare anzeigen
    
I tried to make a figure with several subplots of maps. There is always space between subplots that I don't know how to remve. Below is the code and results. Anyone can help me? 
close all
clear
latrng = [21.06    70];
lonrng = [-160   -51.62];
fw = 0.24;
fh = fw*((latrng(2)-latrng(1))/180)/((lonrng(2)-lonrng(1))/360);
positions = [0.05       1-1*fh   fw fh;
             0.05       1-2*fh fw fh;
             0.05       1-3*fh fw fh;
             0.05       1-4*fh fw fh;
             0.05+fw    1-1*fh fw fh;
             0.05+fw    1-2*fh fw fh;
             0.05+fw    1-3*fh fw fh;
             0.05+fw    1-4*fh fw fh;
             0.05+2*fw  1-1*fh fw fh;
             0.05+2*fw  1-2*fh fw fh;
             0.05+2*fw  1-3*fh fw fh;
             0.05+2*fw  1-4*fh fw fh;];
Months = {'Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'};
figure('WindowState','maximized')
for Mn = 1:12
    subplot('Position',positions(Mn,:))
    worldmap(latrng,lonrng)
    setm(gca,'Grid','off','MapProjection','miller','parallellabel','off','meridianlabel','off')
    text( min(xlim)+0.1*(max(xlim)-min(xlim)), min(ylim)+0.1*(max(ylim)-min(ylim)), Months{Mn},'fontsize',10  )]
end

0 Kommentare
Antworten (1)
  Harsha
    
 am 19 Okt. 2022
        To change the spacing between the subplots, “position” property of the axis can be used but it is tedious.
You can use “tiledlayout” function for adjusting spacing between the subplots instead of “subplot” function. 
Refer to the Adjust Layout Spacing section given in the below link to get a compact layout using “tiledlayout” function. https://in.mathworks.com/help/matlab/ref/tiledlayout.html
0 Kommentare
Siehe auch
Kategorien
				Mehr zu Creating, Deleting, and Querying Graphics Objects finden Sie in Help Center und File Exchange
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!