How to create and load a custom colormap?

55 Ansichten (letzte 30 Tage)
Grace
Grace am 15 Jan. 2019
Kommentiert: Grace am 15 Jan. 2019
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 Kommentar
Stephen23
Stephen23 am 15 Jan. 2019
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');

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Stephen23
Stephen23 am 15 Jan. 2019
Assuming that mymap is a variable in the workspace:
colormap(gca,mymap);

Weitere Antworten (0)

Produkte


Version

R2017a

Community Treasure Hunt

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

Start Hunting!

Translated by