How to change the color of a single point in a scatter plot?

77 views (last 30 days)
I am plotting points:
x = [ 1 1 1 1 1 2 2 2 2 2 3 3 3 3 3 4 4 4 4 4 5 5 5 5 5];
y = [ 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5];
plot(x,y,'*')
I would like to change the color of just an individual point, how do I go about it?

Accepted Answer

Azzi Abdelmalek
Azzi Abdelmalek on 26 Jul 2013
x = [ 1 1 1 1 1 2 2 2 2 2 3 3 3 3 3 4 4 4 4 4 5 5 5 5 5];
y = [ 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5];
plot(x,y)
hold on
scatter(x(7),y(7),'r')
hold off

More Answers (0)

Community Treasure Hunt

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

Start Hunting!