Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
plotting 2points with different colours

Subject: plotting 2points with different colours

From: Jose

Date: 17 Jul, 2009 13:35:03

Message: 1 of 5

Hello everyone,

I need to plot two 2-dimensional points: (x1,y1) and (x2,y2) :

plot([x1,x2] [y1,y2])....it is fine,

but i am interested to plot (x1,y1) in blue,
and (x2,y2) in red.

How is possible to do that?

Thanks in advance.

Jose.

Subject: plotting 2points with different colours

From: someone

Date: 17 Jul, 2009 13:51:01

Message: 2 of 5

"Jose " <jose.l.vega@gmail.com> wrote in message <h3pum7$sgu$1@fred.mathworks.com>...
> Hello everyone,
>
> I need to plot two 2-dimensional points: (x1,y1) and (x2,y2) :
>
> plot([x1,x2] [y1,y2])....it is fine,
>
> but i am interested to plot (x1,y1) in blue,
> and (x2,y2) in red.
>
> How is possible to do that?
>
> Thanks in advance.
>
> Jose.

% Something like:
plot(x1,y1,'.b')
plot(x2,y2,'.r')

Subject: plotting 2points with different colours

From: Jose

Date: 17 Jul, 2009 13:54:02

Message: 3 of 5

"Jose " <jose.l.vega@gmail.com> wrote in message <h3pum7$sgu$1@fred.mathworks.com>...
> Hello everyone,
>
> I need to plot two 2-dimensional points: (x1,y1) and (x2,y2) :
>
> plot([x1,x2] [y1,y2])....it is fine,
>
> but i am interested to plot (x1,y1) in blue,
> and (x2,y2) in red.
>
> How is possible to do that?
>
> Thanks in advance.
>
> Jose.

Ok, I saw an answer from Matt Fig solving the problem:

plot(x1,y1,'bo',x2,y2,'r+')

:)

Subject: plotting 2points with different colours

From: someone

Date: 17 Jul, 2009 13:58:01

Message: 4 of 5

"someone" <someone@somewhere.net> wrote in message <h3pvk5$vj$1@fred.mathworks.com>...
> "Jose " <jose.l.vega@gmail.com> wrote in message <h3pum7$sgu$1@fred.mathworks.com>...
> > Hello everyone,
> >
> > I need to plot two 2-dimensional points: (x1,y1) and (x2,y2) :
> >
> > plot([x1,x2] [y1,y2])....it is fine,
> >
> > but i am interested to plot (x1,y1) in blue,
> > and (x2,y2) in red.
> >
> > How is possible to do that?
> >
> > Thanks in advance.
> >
> > Jose.
>
> % Something like:
> plot(x1,y1,'.b')
> plot(x2,y2,'.r')

% PS Don't forget to include:
hold on
% between the two plot statements.

Subject: plotting 2points with different colours

From: Jose

Date: 17 Jul, 2009 14:29:03

Message: 5 of 5

"someone" <someone@somewhere.net> wrote in message <h3q019$rbp$1@fred.mathworks.com>...
> "someone" <someone@somewhere.net> wrote in message <h3pvk5$vj$1@fred.mathworks.com>...
> > "Jose " <jose.l.vega@gmail.com> wrote in message <h3pum7$sgu$1@fred.mathworks.com>...
> > > Hello everyone,
> > >
> > > I need to plot two 2-dimensional points: (x1,y1) and (x2,y2) :
> > >
> > > plot([x1,x2] [y1,y2])....it is fine,
> > >
> > > but i am interested to plot (x1,y1) in blue,
> > > and (x2,y2) in red.
> > >
> > > How is possible to do that?
> > >
> > > Thanks in advance.
> > >
> > > Jose.
> >

Thanks someone!!!
> > % Something like:
> > plot(x1,y1,'.b')
> > plot(x2,y2,'.r')
>
> % PS Don't forget to include:
> hold on
> % between the two plot statements.

Tags for this Thread

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.

Contact us