how to make a spatial map with two dimensional matrix

조회 수: 11 (최근 30일)
Joydeb Saha
Joydeb Saha 2021년 9월 1일
답변: KSSV 2021년 9월 1일
I have a matrix SH=721X1440
I want to make a spatial map with that. lat=721x1 , lon=1440x1, time = 1044624. I attached lat matrix as lat1 and lon matrix as lon1.
index=find((lon1>180));
new_lon=lon1(index,1)-360;
new_lon1=([new_lon;lon1(1:721)]);
% for l=1:12
% disp(l)
l=1;
flayer=SH(l,:,:);
reshape_one=reshape(SH(l,:,:),[721 1440]);
[LON,LAT] = meshgrid(new_lon1,lat1);
shift_sh=circshift(reshape_one,720,2);
figure1 = figure;
load coast;
axes1 = axes('Parent',figure1,'FontSize',14,'DataAspectRatio',[1 1 1]);
box(axes1,'on');
grid(axes1,'on');
axes1.GridColor = [0, 0, 0];
xlabel(['Longitude (',char(176),')'],'FontSize',18,'FontName','Arial','FontWeight','bold');
ylabel(['Latitude (',char(176),')'],'FontSize',18,'FontName','Arial','FontWeight','bold');
set(gca,'XLim',[-180 180]);
set(gca,'YLim',[-90 90]);
set(gca,'XTick',-180:30:180);
set(gca,'YTick',-90:30:90);
hold on
xlim([-180 180]);
ylim([-90 90]);
h=pcolor(LON,LAT,shift_sh);
h.EdgeColor='none';
hold on
colormap jet
hold on
h1=geoshow(lat, long, 'color', 'black','linewidth', 2);
% colorbar;
c=colorbar;

답변 (1개)

KSSV
KSSV 2021년 9월 1일
Let X, Y, Z be your data. Where X is m*n, Y is m*n and Z is m*n*p matrix.
for i = 1:p
pcolor(X,Y,Z(:,:,i))
drawnow
end
To plot a time series at a point (i,j)
plot(squeeze(Z(i,j))) ;
Also have a look on slice.

카테고리

Help CenterFile Exchange에서 Scatter Plots에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by