フィルターのクリア

How can I change numbers on colorbar?

27 ビュー (過去 30 日間)
Aleksander
Aleksander 2013 年 8 月 22 日
When I show image (uint8) with imshow, and add the colorbar, the colorbar has numbers from 0 to 255 which is logic. Because I want my image to give me the most info that it can, I use histeq and limit my image from 35 to 90 values.
However, I have the picture that gives me enough info, but I want the colorbar from 0 to 1. Because my picture is a NDVI with values from 0 to 1 (0 for non vegetation areas and 1 for vegetation ares).
Is that even possible?
thx, A.

回答 (1 件)

Amith Kamath
Amith Kamath 2013 年 8 月 22 日
you can set the CLim (color limits of the bar) using caxis([min, max]). The default value is the min and max of the plotted data.
For example,
figure,
subplot(2,1,1)
surf(peaks)
colorbar
subplot(2,1,2)
surf(peaks)
caxis([-2, 2])
colorbar
  2 件のコメント
Aleksander
Aleksander 2013 年 8 月 22 日
Thanks for answer, but it's not what i've been looking for. I already tried like this. What i need is, if we look your example that you gave me: I want the same picture and same colorbar as in subplot(2,1,1) but with vaules from -2 to 2. (only the values on colorbar need to change for me, everything else must stay the same)
Aleksander
Aleksander 2013 年 8 月 23 日
I've made it now. My mistake was that I changed my index NDVI from single back to uint8 (I always thought that imshow changes that automatic). Instead of using DisplayRange I'm using histeq and it works fine.
Thx

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeImport, Export, and Conversion についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by