필터 지우기
필터 지우기

How do you change the background to white in your colorbar?

조회 수: 10 (최근 30일)
J Shaw
J Shaw 2012년 9월 10일
Hi!
I am trying to make movies of electron densities, so I have a colorbar for each frame. However, since my values go from 0 to -9 and I am using "Jet," my background is dark red. How can I turn it to white without manually going in and doing it for every slide?
Thanks!

답변 (1개)

Image Analyst
Image Analyst 2012년 9월 10일
Figure out which row is dark red. Then set that row = [1 1 1].
myColorMap = jet(256);
Let's say that your background is say, oh, around -4.5 and the row for that in myColorMap is, say, 128. Then you verify that by looking at the row 128 and see that it is [.5 0 0] which is indeed a dark red. So then you'd just say
myColorMap(128, :) = [1 1 1]; % Set row 128 to white.
% Then apply the colormap
colormap(myColorMap);
colorbar;

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by