creating deciles in a colorbar/colormap

1 回表示 (過去 30 日間)
Ger
Ger 2011 年 7 月 11 日
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

採用された回答

Patrick Kalita
Patrick Kalita 2011 年 7 月 11 日
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 件)

カテゴリ

Help Center および File ExchangeCounter and Timer Input and Output についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by