필터 지우기
필터 지우기

How to to get a figure to fill a box or get a box around the figure

조회 수: 1 (최근 30일)
Bradley
Bradley 2024년 3월 26일
답변: Chunru 2024년 3월 27일
Im not sure how better to describe this in the title but I am creating an average precipitation map of sourthern america. My code works fine right now and I have attached it below, however really no matter what i try I cant get the figure to fill the box. I either want the figure to fill the box or have the box wrap around the figure, I just dont want the white space around the map. My code is below and an example of the current output is below that. Thanks!
% % precip_lat=ncread('precip.mon.ltm.1981-2010.nc','lat');
% % precip_lon=ncread('precip.mon.ltm.1981-2010.nc','lon');
% % precip_time=ncread('precip.mon.ltm.1981-2010.nc','time');
% % precip=ncread('precip.mon.ltm.1981-2010.nc','precip');
% %%
% % precip_WP_monthly=precip(:,:,1:12);
% % [x,y]=meshgrid(precip_lon(:),precip_lat(:));
% % x=double(x);
% % y=double(y);
% close all
%
h3ax=axesm('MapProjection','mercator','MapLatLimit',[-60 -30],'MapLonLimit', [-90 -60],...
'MeridianLabel','on','ParallelLabel','on');
gridm on
% framem on
% h2=surfm(y,x,sum(precip_WP_monthly(:,:,:),3)'./12);
% h2=surfm(y,x,precip_WP_monthly(:,:,1)' - precip_WP_monthly(:,:,7)');
% h2=surfm(y,x,precip_WP_monthly(:,:,6)'-precip_WP_monthly(:,:,8)');
h3=surfm(y,x,((precip_WP_monthly(:,:,12)' + precip_WP_monthly(:,:,1)' + precip_WP_monthly(:,:,2)')/3));
shading interp;
clim manual
clim ([-1, 5])
%caxis ([-7 7])
% colorbar
cmap = flipud(cmocean('diff')) ;
colormap(h3ax,cmap);
load coastlines
plotm(coastlat,coastlon,'k','LineWidth',2)
geoshow(-46.4053, 282.6758,'DisplayType','Point','Marker','d','MarkerFaceColor',[1 0 0],...
'MarkerSize',12,'MarkerEdgeColor','black')
title('Austral Winter Average Percipitation, 1981-2010', "FontSize", 12)

채택된 답변

Chunru
Chunru 2024년 3월 27일

추가 답변 (0개)

태그

제품


릴리스

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by