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:
how can I plot a plotyy on top of another plotyy

Subject: how can I plot a plotyy on top of another plotyy

From: Sofie

Date: 1 Jul, 2010 12:44:04

Message: 1 of 2

Hi,
My problem is this.
I am trying to compare two sets of curves and i have plotted them both using plotyy seperatly, but when i try and plot them is the same figure, using the command hold on, only one of the Y-axis from the first plot is visible. The one that goes missing is the left Y-axis, which should display 3 curves.
I have also tried using hold for the different axis, but no results.

can anyone figure this out?

Subject: how can I plot a plotyy on top of another plotyy

From: Sean

Date: 1 Jul, 2010 14:51:05

Message: 2 of 2

"Sofie " <jarelius@t.kth.se> wrote in message <i0i2ik$2bm$1@fred.mathworks.com>...
> Hi,
> My problem is this.
> I am trying to compare two sets of curves and i have plotted them both using plotyy seperatly, but when i try and plot them is the same figure, using the command hold on, only one of the Y-axis from the first plot is visible. The one that goes missing is the left Y-axis, which should display 3 curves.
> I have also tried using hold for the different axis, but no results.
>
> can anyone figure this out?


x = 1:10;
y1 = [1:10].^2;
y2 = exp(y1)/10;
y3 = [10:-1:1].^2;
y4 = log(10:-1:1);

[A] = plotyy(x,y1,x,y2);
hold on
plotyy(A,x,y3,x,y4)

Tags for this Thread

No tags are associated with 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