Mapping Toolbox: missing values in gridded data sets
Mostrar comentarios más antiguos
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 comentarios
Walter Roberson
el 23 de Feb. de 2014
What error message do you get?
Maarten
el 24 de Feb. de 2014
Respuestas (0)
Categorías
Más información sobre Blue en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!