Filter löschen
Filter löschen

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

10 Ansichten (letzte 30 Tage)
J Shaw
J Shaw am 10 Sep. 2012
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!

Antworten (1)

Image Analyst
Image Analyst am 10 Sep. 2012
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;

Kategorien

Mehr zu Orange finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by