How can I make map subplots larger?

5 ビュー (過去 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 Center および File ExchangeInteractive Control and Callbacks についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by