Heatmap - how to get the plotted colors

7 Ansichten (letzte 30 Tage)
Nils Liebe
Nils Liebe am 3 Sep. 2021
Kommentiert: Nils Liebe am 5 Sep. 2021
Dear all,
I would like to get the rgb-color code of a data set i am plotting in a heatmap. Does anyone know where they are stored or how to extract them?
%Exp.
Data=[0.216745778875956
0.0122005059399983
0.0162673412533310
0.00149830774701733
0.263389055948955
0.342338724357287
0.0955767041221151
0.119981642250681
0.0606266369191968
0.759691756727176
0.514382973045806
0.668104140446562
0.720311719592812
0.671178482390491
0.278785037951106
0.476509405546337
0.409639773389851
0.582438199698988
0.567789956119946
0.281777114781149
0.674368366676059
0.188936792339474
0.746659486291274
0.827451886871509
0.708089195819381
0.345204905187858
0.492727562626227
0.453467008650955];
fig=heatmap(Data,'Colormap',jet);

Antworten (2)

J Chen
J Chen am 3 Sep. 2021
camp = colormap
https://www.mathworks.com/help/matlab/ref/colormap.html
  1 Kommentar
Nils Liebe
Nils Liebe am 5 Sep. 2021
Bearbeitet: Nils Liebe am 5 Sep. 2021
Thanks for your answer.
I already tried colormap(); The problem is that you get all 256 values auf the jet-colormap. I only want the rgb-values of my 28 data points (or the position within the colormap). :(

Melden Sie sich an, um zu kommentieren.


darova
darova am 5 Sep. 2021
Just scale values
%Exp.
Data=[0.216745778875956
0.0122005059399983
0.0162673412533310
0.00149830774701733
0.263389055948955
0.342338724357287
0.0955767041221151
0.119981642250681
0.0606266369191968
0.759691756727176
0.514382973045806
0.668104140446562
0.720311719592812
0.671178482390491
0.278785037951106
0.476509405546337
0.409639773389851
0.582438199698988
0.567789956119946
0.281777114781149
0.674368366676059
0.188936792339474
0.746659486291274
0.827451886871509
0.708089195819381
0.345204905187858
0.492727562626227
0.453467008650955];
n = 100; % number of colors
ind = round(Data*n)+1; % indices of colors (scale)
cm = jet(n); % create colormap
cm(ind,:) % show colors RGB
ans = 28×3
0 0.4000 1.0000 0 0 0.5600 0 0 0.6000 0 0 0.5200 0 0.5600 1.0000 0 0.8800 1.0000 0 0 0.9200 0 0 1.0000 0 0 0.7600 1.0000 0.4400 0

Kategorien

Mehr zu Data Distribution Plots finden Sie in Help Center und File Exchange

Tags

Produkte


Version

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by