# Change the markers color in the figure after plotting

조회 수: 22 (최근 30일)
BN 2021년 12월 8일
편집: DGM 2021년 12월 8일
Dear all,
I used this function in Matlab FEX to draw a Taylor diagram. I really need to change the color of generated markers to some hex colors. Since this function won't accept hex color I want to ask you professionals Is there any way to change the color of each marker to hex colour after I draw? I hope Matlab could save my life again.
% Calculate statistics for Taylor diagram
% The first array element corresponds to the reference series for the
% while the second is that for the predicted series.
taylor_stats1 = taylor_statistics(pred1,ref,'data');
taylor_stats2 = taylor_statistics(pred2,ref,'data');
taylor_stats3 = taylor_statistics(pred3,ref,'data');
% Store statistics in arrays
sdev = [taylor_stats1.sdev(1); taylor_stats1.sdev(2); ...
taylor_stats2.sdev(2); taylor_stats3.sdev(2)];
crmsd = [taylor_stats1.crmsd(1); taylor_stats1.crmsd(2); ...
taylor_stats2.crmsd(2); taylor_stats3.crmsd(2)];
ccoef = [taylor_stats1.ccoef(1); taylor_stats1.ccoef(2); ...
taylor_stats2.ccoef(2); taylor_stats3.ccoef(2)];
% Produce the Taylor diagram.
%
% Note that the first index corresponds to the reference series for the
% diagram. For example sdev(1) is the standard deviation of the reference
% series and sdev(2:4) are the standard deviations of the other series.
% The value of sdev(1) is used to define the origin of the RMSD contours.
% The other values are used to plot the points (total of 3) that appear in
% the diagram.
[hp, ht, axl] = taylor_diagram(sdev,crmsd,ccoef);
I want to change red circules to 3 different colors using hex colors.
Thank you all.

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

### 채택된 답변

DGM 2021년 12월 8일
편집: DGM 2021년 12월 8일
This should be a start
% Calculate statistics for Taylor diagram
taylor_stats1 = taylor_statistics(pred1,ref,'data');
taylor_stats2 = taylor_statistics(pred2,ref,'data');
taylor_stats3 = taylor_statistics(pred3,ref,'data');
% Store statistics in arrays
sdev = [taylor_stats1.sdev(1); taylor_stats1.sdev(2); ...
taylor_stats2.sdev(2); taylor_stats3.sdev(2)];
crmsd = [taylor_stats1.crmsd(1); taylor_stats1.crmsd(2); ...
taylor_stats2.crmsd(2); taylor_stats3.crmsd(2)];
ccoef = [taylor_stats1.ccoef(1); taylor_stats1.ccoef(2); ...
taylor_stats2.ccoef(2); taylor_stats3.ccoef(2)];
% Produce the Taylor diagram.
[hp, ht, axl] = taylor_diagram(sdev,crmsd,ccoef);
% convert a hex tuple
hexcolor = 'FE230A';
deccolor = hex2dec(reshape(hexcolor,[],2)).'/255
for kc = 1:numel(hp)
set(hp(kc),'MarkerFaceColor',deccolor,'MarkerEdgeColor',deccolor)
end
If you want to have a different color for each marker, you can just move the conversion process inside the loop.

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

### 추가 답변 (1개)

Bjorn Gustavsson 2021년 12월 8일
You should be able to change the color of the points by using the hp output:
set(hp(1),'color',[0.95,.3,0.1])
set(hp(2),'color',[0.32,0.1,0.9])
set(hp(3),'color',[0.1,1,0.43])
HTH

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

### 카테고리

Help CenterFile Exchange에서 Descriptive Statistics에 대해 자세히 알아보기

R2021a

### Community Treasure Hunt

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

Start Hunting!

Translated by