Formatting the JET colormap

21 ビュー (過去 30 日間)
Hans123
Hans123 2020 年 6 月 23 日
編集済み: Stephen23 2020 年 6 月 23 日
I am familiar with colormapeditor but every time I type it in the command window, after setting colormap to jet, I edit the parula colormap.
Even after editing the parula in the command window it refreshes back to normal after running a loop.
I hope to resolve this issue, I want the jet colormap but for values that are 0 (the midpoint of my colorbar), the color should be white/or a light color as shown below, the rest of the color map should be unchanged. Appreciate any help regarding this question.

採用された回答

Stephen23
Stephen23 2020 年 6 月 23 日
編集済み: Stephen23 2020 年 6 月 23 日
The colormapeditor changes the colormap of the current figure. It does not save or store the colormap in any way.
You will most likely have to follow a workflow something like this:
figure() % open a figure, or even better plot an image or something similar
colormap(somecolormap) % change to somecolormap
colormapeditor() % adjust the colors until you are happy
Once you are happy with the colormap continue by storing the colormap:
map = colormap(); % store colormap in an array
and then inside the loop use map to set the figure/axes colormap as required:
for ...
fgh = figure();
...
colormap(fgh,map)
end
  2 件のコメント
Hans123
Hans123 2020 年 6 月 23 日
編集済み: Hans123 2020 年 6 月 23 日
Thanks for the reply, Stephen. the colormapeditor() function - how can you write a line of code to make sure the midpoint of jet is white? In the command window a GUI opens up and you change it.
figure
colormap(jet)
colormapeditor(...)
map = colormap(...);
Stephen23
Stephen23 2020 年 6 月 23 日
編集済み: Stephen23 2020 年 6 月 23 日
"how can you write a line of code to make sure the midpoint of jet is white?"
The line colormapeditor() does not set any color values, it just opens the GUI. After doing the required adjustments, you can continue with the rest of the code.

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

その他の回答 (0 件)

カテゴリ

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