[R] Axis Title in persp() Overlaps with Axis Labels

Paul Murrell p.murrell at auckland.ac.nz
Tue Jul 25 22:02:12 CEST 2006


Hi


Kilian Plank wrote:
> Good morning,
> 
> in a 3D plot based on persp() the axis title (of dimension z) overlaps with 
> the axis labels.
> How can the distance (between axis labels and axis title) be increased?


Unfortunately, there is not the same level of control that is available
for 2D plots, but you can "cheat" a bit in this case.  For example, ...

     x <- seq(-10, 10, length= 30)
     y <- x
     f <- function(x,y) { r <- sqrt(x^2+y^2); 10 * sin(r)/r }
     z <- outer(x, y, f)
     z[is.na(z)] <- 1

     par(mfrow=c(2, 1))
     persp(x, y, z, theta = 30, phi = 30, expand = 0.5,
           col = "lightblue", ticktype="detailed")

     persp(x, y, z, theta = 30, phi = 30, expand = 0.5,
           col = "lightblue", ticktype="detailed",
           zlab="\n\n\n\nz")

Paul
-- 
Dr Paul Murrell
Department of Statistics
The University of Auckland
Private Bag 92019
Auckland
New Zealand
64 9 3737599 x85392
paul at stat.auckland.ac.nz
http://www.stat.auckland.ac.nz/~paul/



More information about the R-help mailing list