フィルターのクリア

Plot multiple maps with transparency using raster data

7 ビュー (過去 30 日間)
Qian
Qian 2024 年 3 月 21 日
コメント済み: Qian 2024 年 3 月 21 日
I have a three-Dimension dataset var_slice, the first and second dimensions are latitude and longitude, the third is time. I want to plot all the images for all times together by setting the transparency. So I can get a final figure in which regions have multiple occurence have darker color. How can I overlay all the images? I put the code to plot the map for a singe time below and attached the data. Any help would be appreciated.
% load the 3-D data
load var_slice.mat
load lat.mat
load lon.mat
% plot
pcolor(lon,lat,var_slice(:,:,1))
shading interp;
hold on
borders('continental us','color','k','linestyle','-','linewidth',1.2)
% axis tight
hold off
ylim([25,50])
xlim([-130,-95])

回答 (1 件)

Walter Roberson
Walter Roberson 2024 年 3 月 21 日
% load the 3-D data
load var_slice.mat
load lat.mat
load lon.mat
% plot
for K = 1 : size(var_slice,3)
s = pcolor(lon,lat,var_slice(:,:,1));
s.FaceAlpha = 0.05;
s.EdgeColor = 'none';
hold on
end
%shading interp;
borders('continental us','color','k','linestyle','-','linewidth',1.2)
Unrecognized function or variable 'borders'.
% axis tight
hold off
ylim([25,50])
xlim([-130,-95])
  1 件のコメント
Qian
Qian 2024 年 3 月 21 日
Thank you so much for your help. In the for loop the index should be K: s = pcolor(lon,lat,var_slice(:,:,K)). It works! The borders can be added using https://www.mathworks.com/matlabcentral/fileexchange/50390-borders. Thanks again.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeSurface and Mesh Plots についてさらに検索

タグ

製品


リリース

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by