Skip to content

plot with 2 y axes

2 messages · Christophe Dutang, Ben Bolker

#
Hi all,


I would like to know how to do a plot with 2 y axes in R. With google,  
I found this topic has been discussed twice in the past:
- http://tolstoy.newcastle.edu.au/R/e2/help/06/11/6049.html
- https://stat.ethz.ch/pipermail/r-help/2000-September/008182.html
Those links provide quite a good solution, but I wonder if there  
exists an easier solution to plot two series that have units in R? or  
in a contributed packages?

Thanks in advance

Christophe

--
Christophe Dutang
Ph. D. student at ISFA, Lyon, France
website: http://dutangc.free.fr
#
Christophe Dutang1 wrote:
http://wiki.r-project.org/rwiki/doku.php?id=tips:graphics-base:2yaxes

refers you to twoord.plot in the plotrix package.
(This function is not terribly flexible -- e.g. if you want to plot
a histogram and a line plot with different units, you will have
to revert to doing it yourself with par(new=TRUE) ...)