[R] Secondary y-axis

Uwe Ligges ligges at statistik.uni-dortmund.de
Sat Jul 14 16:24:39 CEST 2001


"M. Shiham Adam" wrote:
> 
> Dear R Users,
> 
> I have been trying to add a  secondary y-axis to an existing plot. I thought
> this could be a trivial matter and have checked the Manual and Mailing List
> Archive to see If I can find a solution.
> 
> It appears the suggested method by Uwe Ligges (fot from the Archive) did not
> work. I am getting an error message saying the  "Error in plot.new() : axis
> style "d" unimplemented". Does any one has simple a fix to this problem.


The following example (and also the one of my old mail) works for me:

 x <- rnorm(100)
 hist(x)
 par(new = TRUE)
 plot(-2:2, 1:5, xaxt = "n", yaxt = "n", xlab="", ylab="")
 axis(4)

If you want two times the identically scaled y-axis to an existing plot,
just use

 plot(...)
 axis(4)


If this doesn't help, please tell us:

 - the code you used exactly
 - version of R
 - OS


Uwe Ligges
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list