Code covered by the BSD License  

Highlights from


4.4 | 25 ratings Rate this file 238 Downloads (last 30 days) File Size: 2.15 KB File ID: #1017
image thumbnail




06 Nov 2001 (Updated )

PLOTYYY - Extends plotyy to include a third y-axis

| Watch this File

File Information

PLOTYYY builds upon plotyy to include a third y-axis. It also provides an easy way of labelling all three y-axes at once.


This file inspired Plots.M, Plotses.M and Ploty4.M.

MATLAB release MATLAB 6.1 (R12.1)
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (27)
05 May 2014 Brigh  
25 Jan 2014 Jutao  
22 Aug 2013 Oleg  
23 Jun 2013 Ana C  
14 Jun 2013 fitou


I am using the function plotyyy and it works fine.
My problem occurs when change the 'xlim' (set(ax,'xlim',[1,12089]); )
The two first curve extend from the first Y axis to the second Y axis
wich is good because this area corresponds with path area. But the third
curve extends from the first Y Axis to the third Y axis wich is outside
of the path area.
As a result my third curve have a part outside of the path area..

Is anybody know how can I solve this ?

09 Jun 2013 Shinobue111

Great function! However, I cant seem add an xaxis label. An example would be nice :)

23 Apr 2013 karthik

Zooming and data cursor problem .. .
only one layer is zooming . . .
what about other 2 layers . . .
plz help

26 Feb 2013 Jakob Sievers

It appears my first comment failed to reach the page. Basically, if you want to use this in a subplot structure do:
- comment out "figure(..."
- pos=get(gca,'pos'); instead of pos = [0.1 0.1 0.7 0.8];
- pos(3)=pos(3)-offset; instead of pos(3)=pos(3)-offset/2;

26 Feb 2013 Jakob Sievers  
26 Feb 2013 Jakob Sievers

correction to the second point:
I changed from
pos = [0.1 0.1 0.7 0.8];
is what I was trying to say.

13 Nov 2012 Stratos  
13 Mar 2012 qiong lin


First thanks for writing such a useful code. I have to add up to three axis and plotyyy works fine.

But the code only generates in new figure, and I didn't manage to generate the three axes into existing figure despite hard trying. Can you please show me how to solve the problem ?

To force the axes to generate in my existing figure, the code
'figure('units','normalized','DefaultAxesXMinorTick','on','DefaultAxesYminorTick','on')' in plotyyy.m is put in comment; plus, position unit converted in centimeter as is the case in my own figure.

The axis 1 and 2 show up, but not the third axis!!

Please any help would be really appreciated.

01 Aug 2011 Miguel Ignacio Barrios

good, thanks

24 Jul 2010 Wu Zhiyong

Thanks, very useful!

Can the third line be changed to be a bar plot?


27 Aug 2009 Mario Liverpool

Very well done! thank u! :)

13 May 2008 Karel Castro

Can't use it calling the file from path, but very useful, thanks! Also labels didn't works as is stated in the example.

25 Oct 2007 Hassan Ri

does not plot two x axes, but plotxx is listed as one of the keywords

22 Mar 2006 YI xu

cannot use in subplot, always generate in a new plot

02 Feb 2005 Izru Garner

Easy to use, and very practical!

09 Sep 2004 Anja Noser  
19 Dec 2003 Libor Wilda

looks realy good

13 Nov 2003 Bejoy Mathews

Thanks a lot..
But do you know any which can plot 5 axes at once?

22 Oct 2003 Si Betts  
05 Jun 2003 Chitra Parthiban

Thanks. It is very useful to plot and analysis the online data's together

16 Mar 2003 Lina Chang

Thanks for coming up with a way of adding additional axes.

05 Mar 2003 robs goldy

Very good

17 Feb 2003 Olivier G

small and simple but useful

Contact us