How to create and load a custom colormap?

55 ビュー (過去 30 日間)
Grace
Grace 2019 年 1 月 15 日
コメント済み: Grace 2019 年 1 月 15 日
I've got a plot which I want to create a colormap which will enable me to see the wrapped properties of the property I'm using (0=2pi).
I've tried using:
colormapeditor
Where I can set the colours I want, and then:
ax=gca
mymap=colormap(ax);
Which, for my specific map, gives me a colormap of:
mymap =
1.0000 1.0000 0
1.0000 0.9688 0.0313
1.0000 0.9375 0.0625
1.0000 0.9063 0.0938
1.0000 0.8750 0.1250
1.0000 0.8438 0.1563
1.0000 0.8125 0.1875
1.0000 0.7813 0.2188
1.0000 0.7500 0.2500
1.0000 0.7188 0.2813
1.0000 0.6875 0.3125
1.0000 0.6563 0.3438
1.0000 0.6250 0.3750
1.0000 0.5938 0.4063
1.0000 0.5625 0.4375
1.0000 0.5313 0.4688
1.0000 0.5000 0.5000
1.0000 0.4688 0.5313
1.0000 0.4375 0.5625
1.0000 0.4063 0.5938
1.0000 0.3750 0.6250
1.0000 0.3438 0.6563
1.0000 0.3125 0.6875
1.0000 0.2813 0.7188
1.0000 0.2500 0.7500
1.0000 0.2188 0.7813
1.0000 0.1875 0.8125
1.0000 0.1563 0.8438
1.0000 0.1250 0.8750
1.0000 0.0938 0.9063
1.0000 0.0625 0.9375
1.0000 0.0313 0.9688
1.0000 0 1.0000
1.0000 0.0323 0.9677
1.0000 0.0645 0.9355
1.0000 0.0968 0.9032
1.0000 0.1290 0.8710
1.0000 0.1613 0.8387
1.0000 0.1935 0.8065
1.0000 0.2258 0.7742
1.0000 0.2581 0.7419
1.0000 0.2903 0.7097
1.0000 0.3226 0.6774
1.0000 0.3548 0.6452
1.0000 0.3871 0.6129
1.0000 0.4194 0.5806
1.0000 0.4516 0.5484
1.0000 0.4839 0.5161
1.0000 0.5161 0.4839
1.0000 0.5484 0.4516
1.0000 0.5806 0.4194
1.0000 0.6129 0.3871
1.0000 0.6452 0.3548
1.0000 0.6774 0.3226
1.0000 0.7097 0.2903
1.0000 0.7419 0.2581
1.0000 0.7742 0.2258
1.0000 0.8065 0.1935
1.0000 0.8387 0.1613
1.0000 0.8710 0.1290
1.0000 0.9032 0.0968
1.0000 0.9355 0.0645
1.0000 0.9677 0.0323
1.0000 1.0000 0
However, I can't seem to use it when I'm plotting using the following line:
subplot(3,3,9);imagesc(reconThresh);title('Text (A)'); colormap(gca, 'mymap');
Having tried to load it using:
load('mymap.mat');
Any help will be much appreciated, thank you!
  1 件のコメント
Stephen23
Stephen23 2019 年 1 月 15 日
It is not a good practice to put multiple statements on one line:
subplot(3,3,9);imagesc(reconThresh);title('Text (A)'); colormap(gca, 'mymap');
It is much clearer to give each statement its own line:
subplot(3,3,9);
imagesc(reconThresh);
title('Text (A)');
colormap(gca, 'mymap');

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

採用された回答

Stephen23
Stephen23 2019 年 1 月 15 日
Assuming that mymap is a variable in the workspace:
colormap(gca,mymap);
  1 件のコメント
Grace
Grace 2019 年 1 月 15 日
Thank you very much.

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeBlue についてさらに検索

製品


リリース

R2017a

Community Treasure Hunt

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

Start Hunting!

Translated by