[R] Axis Limits in Scatterplot3d

Uwe Ligges ligges at statistik.tu-dortmund.de
Fri May 22 17:40:01 CEST 2009

Alan wrote:
> Hi,
> How do you obtain the limits of the plotting region in a scatterplot3d
> plot?  `par('usr')' does not seem to give sensible values, and that
> vector only has 4 elements (not the expected 6).

Well, I never designed anything to do that, but it is possible with the 
following function:

gets3dusr <- function(s3dobject){
     es3d <- environment(s3d$points3d)
     g3d <- function(name) get(name, envir=es3d)
     c(c(g3d("x.min"), g3d("x.max")) * g3d("x.scal"),
       c(0, g3d("y.max")) * g3d("y.scal") + g3d("y.add"),
       c(g3d("z.min"), g3d("z.max")) * g3d("z.scal"))


s3d <- scatterplot3d(rnorm(5), rnorm(5), rnorm(5))

Uwe Ligges

> Alan
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

More information about the R-help mailing list