rescale the colour range or squeez the colours

I have a color bar scale changing from 600 to 1020 based on the matrix values while only 2 colors of the range change from day to day. In other hand the most variations in my project belong to the range between 950 to 1025 or 1030. When I use caxis, the colorbar scale doesn't change and I see the range from 900 to 1030 for example which is correct but the pattern colour changes & goes to the real clour belonging to their own values. How can I see the same colour variations but for the new range. xlim and ylim doesn't work in this case.

Answers (3)

If you can give some example data that would help. But this might be the fix you're looking for. If you start with
colormap(jet(256))
That sets the colormap to a 256-level rainbow colormap. If you only want to show part of that rainbow you can do
mycolormap = jet(256);
colormap(mycolormap(100:160,:))
to show levels 100 to 160 of the rainbow colormap.
I should clarify, I use the rainbow colormap only because it's a simple example that you can replicate on any version of Matlab. In general, it is a bad colormap. I recommend using Stephen Cobeldick's brewermap instead.
this is what I get based on the real data
and after using caxis ([900 1030]):

1 Comment

But on the map again I want to see for example dark red for 1030 and dark blue for 900.

Sign in to comment.

Asked:

SH
on 25 Aug 2015

Commented:

SH
on 25 Aug 2015

Community Treasure Hunt

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

Start Hunting!