How to show a colorbar of a certain range?
Sean de Wolski asked
on 15 Jul 2011
Latest activity:
Answer by Titus Edelhofer
on 15 Jul 2011
Hello all and happy Friday! Let's say I have an image with a colormap and corresponding colorbar I = imread('cameraman.tif');
imshow(I);
colormap jet
colorbar
I want the colorbar to only show colors for a certain range of values: range_care = [100 150]; %show colors for values 100:150 Any ideas? Thanks, plzzzz rply qckly its urgenttt had to :) Products |
|---|
Hi,
something like this:
h = colorbar; set(h, 'ylim', [100 150])
Titus
sorry, if it wasn't quick enough ;-)
That's it, and plenty quick - before third cup of coffee even...
Okay I don't know whether this is the right one or not.
But I have tried this.
I = imread('cameraman.tif');
imshow(I,'DisplayRange',[100 150]);
colormap jet
colorbar
Hope this is what your looking for.
-Harsha
Thank you, but that's not what I'm looking for. That turns everything above 150 to red and everything below 100 to blue. I want the full range of the colormap displayed on the image; just the colorbar showing a fraction of the range.
Contact us at files@mathworks.com
0 comments