Assume
a=[1 5 7 1 3 9 4 6 8 7];
b=[4 5 6 7 2 6 9 4 2 1];
c=[1 2 0 1 0 2 1 1 0 1];
scatter(a,b)
How can I now color the dots using a color code from 0 to 2 corresponding to the values in c?

 채택된 답변

jonas
jonas 2018년 9월 18일
편집: jonas 2018년 9월 18일

0 개 추천

3rd argument is variable size and 4th is variable color.
scatter(a,b,[],c,'filled')
where 'filled' is optional.
If you want another set of colors, just set a different or custom colormap (default is parula)

댓글 수: 2

Florian
Florian 2018년 9월 18일
Perfect, thanks!
jonas
jonas 2018년 9월 18일
My pleasure!

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

추가 답변 (0개)

카테고리

태그

질문:

2018년 9월 18일

댓글:

2018년 9월 18일

Community Treasure Hunt

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

Start Hunting!

Translated by