www.gusucode.com > map 案例源码 matlab代码程序 > map/CreateWorldmapOfKoreaAndDisplayNaNsAsTransparentExample.m
%% Create Map of Korea and Display NaNs as Transparent % Display a map, interpreting NaNs as transparent. This example uses the % |geoshow| function with the |'DisplayType'| parameter set to |'surface'| . %% % Load map of Korean peninsula. % Copyright 2015 The MathWorks, Inc. korea = load('korea'); Z = korea.map; %% % Insert an band of null values using NaNs. Z(80:100,:) = NaN; %% % Create a raster reference object. R = georasterref('RasterSize',size(Z),... 'Latlim',[30 45], 'Lonlim', [115 135]); %% % Display world map with NaN values displayed as transparent. Note that the % settings for |ZData| and |CData| ensure that the resulting surface falls % in the |z == 0| plane, instead of being 3-dimensional. figure; worldmap(Z,R) geoshow(Z,R,'DisplayType','surface','ZData',zeros(size(Z)),'CData',Z) demcmap(Z)