How to set background as black without appearing in colorbar?

조회 수: 5 (최근 30일)
Shing
Shing 2013년 3월 29일
Hi, I have an image and the pixel values range from 0 to 180, represented by jet colorbar range.
However, I would like to differentiate my object in the image with its background by setting the background pixels out of the [0 180] range, such as 500, and make the pixels which have 500 value to be black.
But I do not want it to appear as part of the color bar. How can I go about doing that ??
Any form of help is much appreciated and happy holiday! :)

답변 (2개)

Doug Hull
Doug Hull 2013년 3월 29일
Axes have color. You could set the color of the axes. Then you can put NaN in the image on any pixel you want to be 'empty'.
  댓글 수: 1
Shing
Shing 2013년 3월 30일
Hi,
I tried setting NaN into my image matrice. But how do I go about setting it as black background without it appearing within color bar?

댓글을 달려면 로그인하십시오.


Sean de Wolski
Sean de Wolski 2013년 3월 29일
Set the 'YLim' property of the colorbar to be the range you want:
surf(peaks);
h = colorbar;
set(h,'YLim',[2 5]);

카테고리

Help CenterFile Exchange에서 Colormaps에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by