How can I make map subplots larger?

1 次查看(过去 30 天)
Audrey
Audrey 2016-11-7
编辑: Audrey 2016-11-8
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

回答(1 个)

Audrey
Audrey 2016-11-8
编辑:Audrey 2016-11-8
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

类别

Help CenterFile Exchange 中查找有关 2-D and 3-D Plots 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by