Thread Subject: Superimpose 2 plots

Subject: Superimpose 2 plots

From: Luca Cerone

Date: 28 Jan, 2008 09:13:02

Message: 1 of 3

Hi,
I want tu superimpose two plots.

I have something like

x1=[1:1000]
y1=rand(1,1000)

x2=[1:100]
y2=1000*rand(1,100)

I make

f_h=figure;

p1_h=plot(x1,y1)
hold on

p2_h=plot(x2,y2)


%of course I almost can't see x1,y1 as y2 is much greater
than y1, and I also want to stretch the x2 axis, so that x2
takes the whole figure length.

I understand I have to use the set function,
for esample if I want to change the color I make
set(p2_h,'Color','k') to make it black.

Which are the options so that I can put the x2 axis in the
top of the figure, stretch it to the whole length, put the
y2 axis on the left with a different scale,
and so that both (x1,y1) and (x2,y2) are visible?
Where can I find a comprehensive list of properties to set
in figures?

Thank you very much to all of you in advance!
Hope you can help me!
Cheers -Luca-


Subject: Superimpose 2 plots

From: marky

Date: 28 Jan, 2008 09:50:17

Message: 2 of 3

Luca Cerone wrote:
> Hi,
> I want tu superimpose two plots.
>
> I have something like
>
> x1=[1:1000]
> y1=rand(1,1000)
>
> x2=[1:100]
> y2=1000*rand(1,100)
>
> I make
>
> f_h=figure;
>
> p1_h=plot(x1,y1)
> hold on
>
> p2_h=plot(x2,y2)
>
>
> %of course I almost can't see x1,y1 as y2 is much greater
> than y1, and I also want to stretch the x2 axis, so that x2
> takes the whole figure length.
>
> I understand I have to use the set function,
> for esample if I want to change the color I make
> set(p2_h,'Color','k') to make it black.
>
> Which are the options so that I can put the x2 axis in the
> top of the figure, stretch it to the whole length, put the
> y2 axis on the left with a different scale,
> and so that both (x1,y1) and (x2,y2) are visible?
> Where can I find a comprehensive list of properties to set
> in figures?

help SUBPLOT

Subject: Superimpose 2 plots

From: Pekka

Date: 28 Jan, 2008 11:19:02

Message: 3 of 3

"Luca Cerone" <cerone@to-see.it> wrote in message
<fnk6au$3ds$1@fred.mathworks.com>...

> Where can I find a comprehensive list of properties to
set
> in figures?

open help, click MATLAB and then
Handle Graphics Property Browser

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
plotyy Luca Cerone 28 Jan, 2008 04:15:04
plot Luca Cerone 28 Jan, 2008 04:15:04
superimpose Luca Cerone 28 Jan, 2008 04:15:04
overlap Luca Cerone 28 Jan, 2008 04:15:04
rssFeed for this Thread

Public Submission Policy

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Disclaimer prior to use.

Contact us at files@mathworks.com