필터 지우기
필터 지우기

How can I make map subplots larger?

조회 수: 2 (최근 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에서 Interactive Control and Callbacks에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by