How can I make map subplots larger?

1 Ansicht (letzte 30 Tage)
Audrey
Audrey am 7 Nov. 2016
Bearbeitet: Audrey am 8 Nov. 2016
I am trying to create a figure with 12+ maps on it. When I create each subplot, however, the maps are tiny with huge whitespace in between. How can I make each map larger?
figure;
set(gcf,'position',[103 37 2354 1308],'PaperPositionMode','auto','BackingStore','off','PaperOrientation','landscape');
cnt=0;
for jj=1:12
cnt=cnt+1;
subplot(nr,nc,cnt)
ax=worldmap('World');
setm(ax,'Origin',[0 -160 0]); % center on Pacific
geoshow(land, 'Facecolor',[0.5 0.5 0.5]);
mn=nanmin(data_moclim.(varnames{vv})(:));
mx=nanmax(data_moclim.(varnames{vv})(:));
colormap(jet(250));
caxis([mn mx]);
pcolorm(data.lat,data.lon,data_moclim.(varnames{vv})(:,:,jj));
set(gca,'fontsize',18,'fontweight','bold');
drawnow;
end

Antworten (1)

Audrey
Audrey am 8 Nov. 2016
Bearbeitet: Audrey am 8 Nov. 2016
So, it seems you can set the position of each subplot, BUT (big BUT here), you have to pre-create all the subplots first and THEN set the position. Otherwise, if the position of one subplot overlaps the position of any previous subplot, then it wipes it out.
Note that position is [left bottom width height]
figure;
set(gcf,'position',[103 438 2354 907],'PaperPositionMode','auto','BackingStore','off','PaperOrientation','landscape');
cnt=0;
nr=3;
nc=4;
mn=nanmin(data_moclim.(varnames{vv})(:));
mx=nanmax(data_moclim.(varnames{vv})(:));
for jj=1:12
cnt=cnt+1;
s(jj)=subplot(nr,nc,cnt);
end
cnt=0;
for jj=1:12
cnt=cnt+1;
subplot(s(jj))
if rem(jj,nc)==0
s(jj).Position=[1-(1/nc) 1-(ceil(jj/nc)/nr) 1/nc 1/nr];
else
s(jj).Position=[(rem(jj,nc)/nc)-(1/nc) 1-(ceil(jj/nc)/nr) 1/nc 1/nr];
end
ax=worldmap('World');
setm(ax,'Origin',[0 -160 0]);
colormap(jet(250));
caxis([mn mx]);
pcolorm(data.lat,data.lon,data_moclim.(varnames{vv})(:,:,jj));
geoshow(land, 'Facecolor',[0.5 0.5 0.5]);
set(gca,'fontsize',18,'fontweight','bold');
drawnow;
end

Kategorien

Mehr zu 2-D and 3-D Plots 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!

Translated by