This is what you are trying to get at I think:
dev.off() ## start with a new graphics device
# X11() or postscript()
#par(mar = c(3,3,1,3), oma = c(0,0,0,0), mgp = c(2, 1, 0), bg =
"white")
par(mar = rep(5,4))
plot(x<-rnorm(100),y<-rnorm(100), ylab = "This is y", xlab =
"This is x")
z<-rnorm(100)*250
par(new=T) ## Tell R not to reinitialize graphic device
## for subsequent plots
plot(x,z,col='blue',axes=F, xlab="", ylab="")
axis(side=4,col.axis='blue', labels = T)
mtext("This is z", 4, 2, col = "blue")
par(new=F)
HTH, Andy
> -----Original Message-----
> From: r-help-bounces at stat.math.ethz.ch
> [mailto:r-help-bounces at stat.math.ethz.ch]On Behalf Of Luis Ridao Cruz
> Sent: Tuesday, February 22, 2005 9:29 AM
> To: r-help at stat.math.ethz.ch
> Subject: [R] R-help
>
>
> R-help,
>
> I am tring to create a plot with two y-axis.
> I found an example which is fine but the problem is that the range of
> the second y-axes appears in the first y-axes causing confusion.
> The example I refer to is :
>
> ##################################
> dev.off() ## start with a new graphics device
> # X11() or postscript()
> plot(x<-rnorm(100),y<-rnorm(100))
> z<-rnorm(100)*250
> par(new=T) ## Tell R not to reinitialize graphic device
> ## for subsequent plots
> plot(x,z,col='blue',axes=F)
> axis(side=4,col.axis='blue')
>
> par(new=F)
> ##################################
>
> which can be found at :
>
> http://www.demog.berkeley.edu/faq/node21.html
>
> I also have a home made-example with exactly the same problem (pretty
> much the same as above)
>
> Any solution?
>
> Thanks in advance.
>
> > version
> _
> platform i386-pc-mingw32
> arch i386
> os mingw32
> system i386, mingw32
> status
> major 2
> minor 0.1
> year 2004
> month 11
> day 15
> language R
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide!
http://www.R-project.org/posting-guide.html