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 CenterFile Exchange에서 Counter 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