Heatmap - how to get the plotted colors

조회 수: 11 (최근 30일)
Nils Liebe
Nils Liebe 2021년 9월 3일
댓글: Nils Liebe 2021년 9월 5일
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);

답변 (2개)

J Chen
J Chen 2021년 9월 3일
camp = colormap
https://www.mathworks.com/help/matlab/ref/colormap.html
  댓글 수: 1
Nils Liebe
Nils Liebe 2021년 9월 5일
편집: Nils Liebe 2021년 9월 5일
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). :(

댓글을 달려면 로그인하십시오.


darova
darova 2021년 9월 5일
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
  댓글 수: 1
Nils Liebe
Nils Liebe 2021년 9월 5일
Exactly what I needed.
Thanks a lot :)

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Data Distribution Plots에 대해 자세히 알아보기

태그

제품


릴리스

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by