Heatmap - how to get the plotted colors
7 次查看(过去 30 天)
显示 更早的评论
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);
0 个评论
回答(2 个)
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
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Data Distribution Plots 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!