필터 지우기
필터 지우기

Set specific Marker Edge and Face Colour for gscatter group of points

조회 수: 5 (최근 30일)
Bruno Martinico
Bruno Martinico 2020년 10월 30일
댓글: Bruno Martinico 2020년 11월 3일
I want to colour edge and face of marker point on the base of values in g.
But there are 2 problems:
  • I do not know a-priori how many groups of points (elements in g with different values) I have.
  • I want each specific group has a specific couple of marker face colour and marker edge colour that I define. For example if g(10)=3.5 i need to set marker face colour [1 1 1] and marker edge colour [0 0.6 0.8].
If I had the possibility to relate each h(i) Line Objects to the corresponding g(j) value I could set exactly the colors with commands:
h(i).MarkerEdgeColor=[ colour related to g(j) ];
h(i).MarkerFaceColor=[ colour related to g(j) ];
Example in the attached file
Thanks
  댓글 수: 1
Bruno Martinico
Bruno Martinico 2020년 11월 3일
Wondeful I resolved with this loop on I values (values in accordance with which I define RGB triplets), but not without SS benediction, because hgscat create by default gscatter objects sorted in ascending order regardless of the order of M_Pts(:,i) group markers (numbers).
fMarkFaceCol(I) and fMarkEdgeCol(I) give me the triplet RGB according to the I values
hgscat=gscatter(M_Pts(:,2),M_Pts(:,1),M_Pts(:,i),[],'o',[],'on');
k=1;
for I=1:0.5:11
if k<=length(hgscat)
if ismember(I,M_Pts(:,i))
hgscat(k).MarkerFaceColor=fMarkFaceCol(I);
hgscat(k).MarkerEdgeColor=fMarkEdgeCol(I);
k=k+1;
end
end
end

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

답변 (0개)

Community Treasure Hunt

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

Start Hunting!

Translated by