Thread Subject: plot in different colors

Subject: plot in different colors

From: stat

Date: 25 Nov, 2009 10:32:04

Message: 1 of 4

Hello all,
I have X and Y 2 vectors and I want to plot(X,Y,'o') but with each 'o' having a different color, is it possible ?
As an information length(X) have non constant value but is never very big (let say 50 at most)
Thanks If you can help

statquant

Subject: plot in different colors

From: Husam Aldahiyat

Date: 25 Nov, 2009 10:59:17

Message: 2 of 4

"stat " <statquant@gmail.com> wrote in message <hej133$hp8$1@fred.mathworks.com>...
> Hello all,
> I have X and Y 2 vectors and I want to plot(X,Y,'o') but with each 'o' having a different color, is it possible ?
> As an information length(X) have non constant value but is never very big (let say 50 at most)
> Thanks If you can help
>
> statquant

for k = 1:length(X)

p = plot(X(k),Y(k),'o');

C = [rand rand rand]*0.5;
set(p,'color',C)

end

Subject: plot in different colors

From: Husam Aldahiyat

Date: 25 Nov, 2009 11:01:19

Message: 3 of 4

Don't forget

hold on

At the beginning of the code.

Subject: plot in different colors

From: stat

Date: 25 Nov, 2009 11:29:06

Message: 4 of 4

"Husam Aldahiyat" <numandina@gmail.com> wrote in message <hej2pv$fno$1@fred.mathworks.com>...
> Don't forget
>
> hold on
>
> At the beginning of the code.

Thank you very much sir

Tags for this Thread

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

rssFeed for this Thread

Contact us at files@mathworks.com