MATLAB: Seeking guidance in log scaled colorbar display error

colormaplog scale colorbar

I'm working on a grid displaying data on a map of the CONUS. In order to better differentiate the lower values, I want to create a log color scale. However, when I try to add my colorbar at the end, it gives me an error: "While setting the 'Limits_I' property of ColorBar: Value must be a 1×2 vector of numeric type in which the second element is larger than the first". I am seeking some guidance in a workaround. Thanks.
states = geoshape(shaperead('usastatehi', 'UseGeoCoords', true));
figure('Visible','on');
hold on
ax = usamap([25 50],[-125 -65]);
geoshow(states,'FaceColor', 'w','FaceAlpha',.3)
geoshow(Y, X, Z, 'DisplayType','texturemap','FaceAlpha',.8)
myscale = [0 1.5];
caxis(log10(myscale))
colormap(flipud(jet))
colorbar

Best Answer

Hi AMart, It appears that the problem is, since log(0) = -inf, you are effectively saying caxis([-inf, log10(1.5)]). If you change 0 to 1e-2 or whatever is reasonable, it should work.