Plot colored grid with transparency and overlay
조회 수: 2 (최근 30일)
이전 댓글 표시
Hello all,
I'm looking for a way to plot an n x m x 3 matrix to recreate the following type of graph:
the 3rd dimension will be global grids of data which range between 0-1. What I would like to do:
find a plot call where I can plot a global grid of the first dimension (with transparency and a specific color, say red), hold on, and then overly the next dimension and so forth so that I can view a gradient of the combination of all three factors.
If any of you have any ideas about how to approach this I would be very grateful. Thanks!
댓글 수: 0
답변 (1개)
Chad Greene
2015년 3월 30일
The simplest way I can think of is to concatenate the three variables as individual RGB values and display as an image like this:
% Some fake data:
[lon,lat] = meshgrid(-179:2:179,89.5:-1:-89.5);
temp = mat2gray(peaks(180)); % mat2gray normalizes 0 to 1
sun = cosd(lat);
water = abs(sind(lon));
% Optional: mask out the ocean:
ocean = ~landmask(lat,lon);
temp(ocean) = NaN;
sun(ocean) = NaN;
water(ocean) = NaN;
% Concatenate 3 variables as rgb:
im = cat(3,temp,sun,water);
% Plot:
worldmap('world')
geoshow(lat,lon,im)
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Mapping Toolbox에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!