How can I change the color of a single point on a scatter plot?

조회 수: 14 (최근 30일)
t sizzle
t sizzle 2021년 4월 28일
답변: t sizzle 2021년 4월 28일
I have a scatter plot of points but I would like to change the color of one while leaving the rest alone. I read through the scatter documentation and some other posts similar to this, but I was not able to get it to work.
x = [1.2,3,5.67,7.8,3.9]
y = [2.8,7,1.02,8.2,5]
scatter(x,y,'filled')
xlim([0 10])
ylim([0 10)])
If it helps, the point I would like to be a different color consists of the last values in each array.

채택된 답변

t sizzle
t sizzle 2021년 4월 28일
Well, I tried one last time and got it. I swear I tried this before asking but here was the solution
x = [1.2,3,5.67,7.8]
y = [2.8,7,1.02,8.2]
x2 = [3.9]
y2 = [5]
scatter(x,y,'filled')
hold on
scatter(x2,y2,'r')
hold off
xlim([0 10])
ylim([0 10)])

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Scatter Plots에 대해 자세히 알아보기

제품


릴리스

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by