creating deciles in a colorbar/colormap
1 view (last 30 days)
Show older comments
Hi,
I'm trying to create deciles in my colourbar. I have rainfall anomalies for 306 stations over 149 years (1863-2011) and for every month of the 149 years (12 months per year).
So far I have only figured out how to give my colorbar a set minimum and maximum value. I would prefer to be able to set my colorbar to have deciles going out in steps of 20% from the 0 value. Hence i would have 10 deciles [>80%, 80 to 60%, 60 to 40%, 40 to 20%, 20 to 0%, 0 to -20%, -20 to -40%, -40 to -60%, - 60 to -80%, <-80%]
thanks for any help anyone can provide...
ZI = griddata(x,y,z,XI,YI);
% plot the results
pcolor(xi,yi,ZI)
xlabel('Longitude (^o)')
ylabel('Latitude (^o)')
title('Mapped Rainfall Anomaly (mm/month) for January 1997')
colormap
caxis([-1000 1000])
colorbar
0 Comments
Accepted Answer
Patrick Kalita
on 11 Jul 2011
You should be able to do that by setting a colormap with only 10 values. For example, using the jet colormap:
pcolor(peaks);
colormap(jet(10))
colorbar
caxis([-10 10])
For a list of other colormaps you can use see this documentation page. Any of them will accept a numeric input argument to specify the number of colors.
0 Comments
More Answers (0)
See Also
Categories
Find more on Counter and Timer Input and Output 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!