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:
Seconday axis in a plot

Subject: Seconday axis in a plot

From: Tesfaye Kebede

Date: 15 Sep, 2010 17:22:21

Message: 1 of 7

I have two variables, both dependent on a third variable. I want to plot the two variables as a function of the third variable, one in the normal upward vertical axis and the second one in the reversed direction downward direction, both on the same plot and in a bar format.

But, I could not get the second reversed vertical axis on the same plot as the one with the normal upward axis.

Any help is appreciated.
Thanks,
Ts

Subject: Seconday axis in a plot

From: Sean

Date: 15 Sep, 2010 17:37:05

Message: 2 of 7

"Tesfaye Kebede" <tesfaye_ab88@yahoo.com> wrote in message <i6qvcd$qhr$1@fred.mathworks.com>...
> I have two variables, both dependent on a third variable. I want to plot the two variables as a function of the third variable, one in the normal upward vertical axis and the second one in the reversed direction downward direction, both on the same plot and in a bar format.
>
> But, I could not get the second reversed vertical axis on the same plot as the one with the normal upward axis.
>
> Any help is appreciated.
> Thanks,
> Ts

doc plotyy

Take specific looks at Xdir, Ydir under "YAxisDirection" in the see also portion and in the 'function' option as this will be 'bar' for you.

Subject: Seconday axis in a plot

From: dpb

Date: 15 Sep, 2010 17:44:35

Message: 3 of 7

Tesfaye Kebede wrote:
> I have two variables, both dependent on a third variable. I want to plot
> the two variables as a function of the third variable, one in the normal
> upward vertical axis and the second one in the reversed direction
> downward direction, both on the same plot and in a bar format.
> But, I could not get the second reversed vertical axis on the same plot
> as the one with the normal upward axis.
...

 >> x=1:10; y=rand(10,2);
 >> ax=plotyy(x,y(:,1),x,y(:,2));
 >> set(ax(2),'ydir','rev')
 >>

works fine here. What's your attempt look like?

--

Subject: Seconday axis in a plot

From: Tesfaye Kebede

Date: 16 Sep, 2010 01:45:22

Message: 4 of 7

dpb <none@non.net> wrote in message <i6r0t8$aem$1@news.eternal-september.org>...
> Tesfaye Kebede wrote:
> > I have two variables, both dependent on a third variable. I want to plot
> > the two variables as a function of the third variable, one in the normal
> > upward vertical axis and the second one in the reversed direction
> > downward direction, both on the same plot and in a bar format.
> > But, I could not get the second reversed vertical axis on the same plot
> > as the one with the normal upward axis.
> ...
>
> >> x=1:10; y=rand(10,2);
> >> ax=plotyy(x,y(:,1),x,y(:,2));
> >> set(ax(2),'ydir','rev')
> >>
>
> works fine here. What's your attempt look like?

Sean and dpb,
Thank you very much for the help.
I used plotyy function and now it works fine. You saved me much time.
Ts.

Subject: Seconday axis in a plot

From: Tesfaye Kebede

Date: 16 Sep, 2010 01:45:22

Message: 5 of 7

dpb <none@non.net> wrote in message <i6r0t8$aem$1@news.eternal-september.org>...
> Tesfaye Kebede wrote:
> > I have two variables, both dependent on a third variable. I want to plot
> > the two variables as a function of the third variable, one in the normal
> > upward vertical axis and the second one in the reversed direction
> > downward direction, both on the same plot and in a bar format.
> > But, I could not get the second reversed vertical axis on the same plot
> > as the one with the normal upward axis.
> ...
>
> >> x=1:10; y=rand(10,2);
> >> ax=plotyy(x,y(:,1),x,y(:,2));
> >> set(ax(2),'ydir','rev')
> >>
>
> works fine here. What's your attempt look like?

Sean and dpb,
Thank you very much for the help.
I used plotyy function and now it works fine. You saved me much time.
Ts.

Subject: Seconday axis in a plot

From: Tesfaye Kebede

Date: 16 Sep, 2010 01:49:04

Message: 6 of 7

dpb <none@non.net> wrote in message <i6r0t8$aem$1@news.eternal-september.org>...
> Tesfaye Kebede wrote:
> > I have two variables, both dependent on a third variable. I want to plot
> > the two variables as a function of the third variable, one in the normal
> > upward vertical axis and the second one in the reversed direction
> > downward direction, both on the same plot and in a bar format.
> > But, I could not get the second reversed vertical axis on the same plot
> > as the one with the normal upward axis.
> ...
>
> >> x=1:10; y=rand(10,2);
> >> ax=plotyy(x,y(:,1),x,y(:,2));
> >> set(ax(2),'ydir','rev')
> >>
>
> works fine here. What's your attempt look like?

Sean and dpb,
Thank you very much for the help.
I used plotyy function and now it works fine. You saved me much time.
Ts.

Subject: Seconday axis in a plot

From: Tesfaye Kebede

Date: 16 Sep, 2010 01:49:05

Message: 7 of 7

dpb <none@non.net> wrote in message <i6r0t8$aem$1@news.eternal-september.org>...
> Tesfaye Kebede wrote:
> > I have two variables, both dependent on a third variable. I want to plot
> > the two variables as a function of the third variable, one in the normal
> > upward vertical axis and the second one in the reversed direction
> > downward direction, both on the same plot and in a bar format.
> > But, I could not get the second reversed vertical axis on the same plot
> > as the one with the normal upward axis.
> ...
>
> >> x=1:10; y=rand(10,2);
> >> ax=plotyy(x,y(:,1),x,y(:,2));
> >> set(ax(2),'ydir','rev')
> >>
>
> works fine here. What's your attempt look like?

Sean and dpb,
Thank you very much for the help.
I used plotyy function and now it works fine. You saved me much time.
Ts.

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