Scatter plot- changing symbols based on colour
조회 수: 2 (최근 30일)
이전 댓글 표시
I have colour coded my scatter points based on one of my vectors. I am using the following code:
scatter(X,Y,[],VV,'filled')
I would like to use different symbols for different colours for example all red dots are squares all green are triangles etc, How do I do this?
댓글 수: 1
Azzi Abdelmalek
2015년 7월 11일
편집: Azzi Abdelmalek
2015년 7월 11일
Can you post an example? How many colors are you using?
답변 (1개)
Azzi Abdelmalek
2015년 7월 11일
X=1:10
Y=sin(X)
W=randi([0 1],numel(X),3)
cl=dec2bin(1:2^3-1)-'0'
sh='os<>dv^'
figure
hold on
for k=1:numel(X)
scatter(X(k),Y(k),150,W(k,:),'filled',sh(ismember(cl,W(k,:),'rows')))
end
댓글 수: 1
Walter Roberson
2015년 7월 12일
An essential point here is that scatter() can only use one shape at a time, so if you want multiple shapes you need to use multiple scatter() calls.
참고 항목
카테고리
Help Center 및 File Exchange에서 Scatter Plots에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!