Thread Subject: PLOT two graphs in one figure?

Subject: PLOT two graphs in one figure?

From: Jack Branning

Date: 9 Jul, 2008 19:51:01

Message: 1 of 5

Hi,

Does anyone know of a way to plot two vectors in one figure so that one plot is
on top of the other? One plot could be blue, and the other could be red so that
it's easy to distinguish between the two.

Thanks in advance!

Subject: PLOT two graphs in one figure?

From: roberson@ibd.nrc-cnrc.gc.ca (Walter Roberson)

Date: 9 Jul, 2008 19:53:48

Message: 2 of 5

In article <g534r5$eto$1@fred.mathworks.com>,
Jack Branning <jbr.nospam@nospam.com> wrote:

>Does anyone know of a way to plot two vectors in one figure so that one plot is
>on top of the other? One plot could be blue, and the other could be red so that
>it's easy to distinguish between the two.

plot(x1,y1,'b',x2,y2,'r');
--
  "The beauties of conception are always superior to those of
   expression." -- Walter J. Phillips

Subject: PLOT two graphs in one figure?

From: Jack Branning

Date: 9 Jul, 2008 20:25:33

Message: 3 of 5


> plot(x1,y1,'b',x2,y2,'r');
> --
> "The beauties of conception are always superior to those of
> expression." -- Walter J. Phillips

This looks pretty much spot on, thanks! What does it do? I don't know how
to plot both the arrays (A and B). They both look similar to:

1276
147
206
221
281
362
501
641
975
1552

Thanks again!

Subject: PLOT two graphs in one figure?

From: Peter Boettcher

Date: 9 Jul, 2008 20:51:49

Message: 4 of 5

"Jack Branning" <jbr.nospam@nospam.com> writes:

>> plot(x1,y1,'b',x2,y2,'r');
>> --
>> "The beauties of conception are always superior to those of
>> expression." -- Walter J. Phillips
>
> This looks pretty much spot on, thanks! What does it do? I don't know how
> to plot both the arrays (A and B). They both look similar to:
>
> 1276
> 147
> 206
> 221
> 281
> 362
> 501
> 641
> 975
> 1552

type "help plot" and read the resulting documentation.

-Peter

Subject: PLOT two graphs in one figure?

From: roberson@ibd.nrc-cnrc.gc.ca (Walter Roberson)

Date: 9 Jul, 2008 20:59:53

Message: 5 of 5

In article <g536rt$dru$1@fred.mathworks.com>,
Jack Branning <jbr.nospam@nospam.com> wrote:
>
>> plot(x1,y1,'b',x2,y2,'r');

>This looks pretty much spot on, thanks! What does it do? I don't know how
>to plot both the arrays (A and B). They both look similar to:

>1276
>147
>206
>221

plot(1:length(A),A,'b', 1:length(B), B, 'r');


Or, nearly equivilently,

plot(A,'b');
hold on
plot(B,'r');
hold off
--
  "The Romans believed that every man had his Genius, and every
   woman her Juno." -- Thomas Bulfinch

Tags for this Thread

Everyone's Tags:

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.

Tag Activity for This Thread
Tag Applied By Date/Time
plot Jack Branning 9 Jul, 2008 15:55:07
graphs Jack Branning 9 Jul, 2008 15:55:07
rssFeed for this Thread

Contact us at files@mathworks.com