Seeking guidance in log scaled colorbar display error
5 views (last 30 days)
Show older comments
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 1x2 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

0 Comments
Accepted Answer
David Goodmanson
on 20 Mar 2017
Edited: David Goodmanson
on 20 Mar 2017
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.
0 Comments
More Answers (0)
See Also
Categories
Find more on White in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!