[R] lattice wireframe with logarithmically scaled axis?
David Winsemius
dwinsemius at comcast.net
Wed Apr 27 16:01:41 CEST 2011
On Apr 27, 2011, at 6:49 AM, Dr. Meesters, Christian wrote:
> Hi,
>
> I have some questions for the wireframe function of the lattice
> package. My dataset's "x-data" are sampled logarithmically and as
> such I would like to have a semilogarithmic 3D plot when plotting a
> time series. Does anyone know how to change the example in
> http://addictedtor.free.fr/graphiques/sources/source_40.R
> such that x or y would be logarithmically scaled?
The scales information in help(wireframe) refers you to the
corresponding section of help(xyplot) where an example of changing the
scales to logarithmic base 2 on the x axis is presented. A
modification to the arguments in your example restricted to the
positive-positive quadrant succeeds:
> require(lattice)
>
> x <- seq(0.001, pi, len = 20)
> y <- seq(0.001, pi, len = 20)
> g <- expand.grid(x = x, y = y)
> g$z <- sin(sqrt(g$x^2 + g$y^2))
> print(wireframe(z ~ x * y, g, drape = TRUE, scales=list(x =
list(log = 10)),
+ aspect = c(3,1), colorkey = TRUE))
>
> Also, I would like to change the color scale such that it does not
> scale from min to max, but from min to a value below max. Is this
> possible? How?
>
> TIA,
> Christian
--
David Winsemius, MD
West Hartford, CT
More information about the R-help
mailing list