Error in geoshow: (displaytype,'Surface')

3 次查看(过去 30 天)
SChow
SChow 2020-7-17
回答: SChow 2020-7-21
Hi
I am getting a weird error and the geoshow function is not working with 'Displaytype', 'Surface' and
set(gca,'colorscale','log')
. However, it is working without the line, however I require the colorscale in log scales
set(gca,'colorscale','log')
However, it is working with 'Displaytype', 'texturemap'. Which I am avoiding as I do not want the Nan values to show any color according to the answer here https://de.mathworks.com/matlabcentral/answers/253209-hide-nans-in-geoshow
My code until now is,
[LAT LON]=cdtgrid(180/4320);%%using climate data toolbox
%%%data is a matrix of 4320x8640
figure
ax = axesm('MapProjection', 'eckert4','grid','on', ...
'frame', 'on')
%axesm eckert4
worldmap world
hold on
land = island(LAT,LON);
% Set ocean values to NaN:
data(~land) = NaN;
geoshow(LAT,LON,data, 'DisplayType','surface')
CT = customcolormap([0 0.1 0.4 0.6 1], {'#740001','#d62d20','#ffbf00','#005b96','#99ccff'});
colormap(CT)
cb = colorbar;
cb.Label.String = 'PM_2_._5 (\mug/m^3)';
caxis([1 45])
cbarrow
set(gca,'colorscale','log')
%%%using Climate data toolbox @Chad Greene
bordersm
cb.YTick = [1 3 5 10 20 30 45];
cb.YTickLabel = {'1', '3','5', '10', '20', '30', '45'};
plabel;mlabel;
The following warning appears and the plot is not complete, just showing the country boundaries and no surface
Warning: Error creating or updating Surface
Error in value of property CData
DataSpace or ColorSpace transform method failed
Warning: Error creating or updating Surface
Error in value of property CData
DataSpace or ColorSpace transform method failed

回答(1 个)

SChow
SChow 2020-7-21
pcolorm is an immediate alternative to using geoshow.

Community Treasure Hunt

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

Start Hunting!

Translated by