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:
Need to plot two y axes, with several variables

Subject: Need to plot two y axes, with several variables

From: M.H.Ray

Date: 11 Feb, 2010 19:27:47

Message: 1 of 2

Using Matlab R2009b. I'm trying to create a plot with several
variables graphed, with three of them on the primary y axis, and one
on a secondary y axis. I can't figure out a way to do it with PLOT.
PLOTYY only seems to allow me to plot one variable on the primary y
axis, and one on the secondary.

Can anyone help steer me in the right direction?

Subject: Need to plot two y axes, with several variables

From: us

Date: 11 Feb, 2010 19:55:22

Message: 2 of 2

"M.H.Ray" <erinmhray@gmail.com> wrote in message <603a1cbf-9b41-41bd-ae47-57a93d153654@f34g2000yqc.googlegroups.com>...
> Using Matlab R2009b. I'm trying to create a plot with several
> variables graphed, with three of them on the primary y axis, and one
> on a secondary y axis. I can't figure out a way to do it with PLOT.
> PLOTYY only seems to allow me to plot one variable on the primary y
> axis, and one on the secondary.
>
> Can anyone help steer me in the right direction?

one of the solutions
- note: PLOTYY is outdated...

     ah=plotyy(1:10,rand(1,10),1:20,.2*rand(1,20));
     cmap=jet(5);
for i=1:5
     line(1:20,i+.2*rand(1,20),...
          'parent',ah(2),...
          'color',cmap(i,:),...
          'linewidth',4);
end
     set(ah(2),...
          'xlim',[0,21],...
          'ylim',[0,6],...
          'ytick',0:6)

us

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