[R] contour plot or persp plot with log scale?
murdoch at stats.uwo.ca
Thu Feb 12 20:14:57 CET 2009
On 2/12/2009 12:04 PM, Gilbert Brenes wrote:
> Is it possible to draw a contour plot (with contour or filled contour) or a
> a surface plot (with persp or persp3d) with the z axis in a log scale?
For persp or persp3d I think you'd have to do the log transformation
yourself. For example,
x <- 1:100
y <- 1:100
z <- outer(x,y, function(x, y) exp(x/10 + y/10)
logz <- log(z, 10)
persp3d(x,y,logz, axes=FALSE, zlab="z", col="red")
axis3d("z", at=pretty(logz), labels=10^pretty(logz))
More information about the R-help