フィルターのクリア

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 Center および File ExchangeOrange についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by