Mapping Toolbox: missing values in gridded data sets

Hi all,
I have a gridded data set that I'm trying to map with the Mapping Toolbox. The data set only contains values for land, so I want the non-land cells (essentially missing data) to show a specific color. I tried passing NaNs for the non-land cells but it seems that NaNs are simply given the color for the lowest value in the data set, e.g. dark blue for the jet colormap. I tried adding an extra color to bottom of the colormap matrix, but this causes land cells with very low values to be plotted in the same color. See below for a minimal example. What I want is to change the color if the "missing data cells" (eye(20)). I also tried to do this by setting the transparency of the non-land cells, as shown below as well but I'm getting an error message.
Thanks in advance for advice!
data = rand([20,20]);
data(eye(20)==1)=nan; % missing data
lat = linspace(-90,90,21);
lon = linspace(0,360,21);
[latM lonM] = meshgrat(lat,lon);
figure
h_ax = axesm('MapProjection', 'eqdcylin','grid','on','MaplonLimit',[0 360]);
h_map = geoshow(latM,lonM,data,'DisplayType','texturemap')
% add extra color to bottom of colormap; doesn't work
set(gcf,'colormap',[get(gcf,'colormap'); [1 1 1]]);
% set missing data cells to transparent; doesn't work
set(h_map,'alphaData',eye(20))
set(h_map,'faceAlpha','flat')

댓글 수: 2

What error message do you get?
"Warning: FaceAlpha Texture is only possible if FaceColor is Texture and if size(AlphaData) equals size(CData)" 2 times. After running these command the axes are empty.

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

도움말 센터File Exchange에서 Blue에 대해 자세히 알아보기

질문:

2014년 2월 23일

댓글:

2014년 2월 24일

Community Treasure Hunt

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

Start Hunting!

Translated by