wireframe zlim option

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

wireframe zlim option

Marius Hofert
Hello,

I would like to plot a wireframe of a function which is defined on the
unit square using the lattice library (for trellis-like plots). The plot
contains z-values of about 100 (only in the neighborhood of zero) although
most of the z-values are in the range of -let's say- 0 to 10. If I
evaluate this function on an equidistant grid of 25 points on the unit
square the plot quality is not very good, but I can see the rough shape of
the plot (i.e. I can see the that the points in the range of 0 to 10 have
different heights). If I increase the grid points to 100 (so the function
is evaluated on an equidistant grid with 100^2 points), the plot quality
increases (i.e. the plot gets smooth), but I can hardly see any structure
of the plot as the points in the neighborhood of zero of course dominate
the plot (and all points in the range from 0 to 10 seem to just have the
same height) and as I evaluate more of the points close to 0 this behavior
is obvious. Therefore I would like to restrict the z-values plotted. I
couldn't find any help for that and the usual "zlim=c(0,30)" (which should
only plot the z-values lying in the range from 0 to 30) did not work for
the wireframe function of the lattice package.
The call I tried was

>library(lattice)
>wireframe(z~x*y,zlim=c(0,30),drape=T,distance=0,colorkey=list(tick.number=6))

Any hints are appreciated

Thanks in advance

Marius

[hidden email]

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Reply | Threaded
Open this post in threaded view
|

Re: wireframe zlim option

Deepayan Sarkar
On 2/5/06, Marius Hofert <[hidden email]> wrote:

> Hello,
>
> I would like to plot a wireframe of a function which is defined on the
> unit square using the lattice library (for trellis-like plots). The plot
> contains z-values of about 100 (only in the neighborhood of zero) although
> most of the z-values are in the range of -let's say- 0 to 10. If I
> evaluate this function on an equidistant grid of 25 points on the unit
> square the plot quality is not very good, but I can see the rough shape of
> the plot (i.e. I can see the that the points in the range of 0 to 10 have
> different heights). If I increase the grid points to 100 (so the function
> is evaluated on an equidistant grid with 100^2 points), the plot quality
> increases (i.e. the plot gets smooth), but I can hardly see any structure
> of the plot as the points in the neighborhood of zero of course dominate
> the plot (and all points in the range from 0 to 10 seem to just have the
> same height) and as I evaluate more of the points close to 0 this behavior
> is obvious. Therefore I would like to restrict the z-values plotted. I
> couldn't find any help for that and the usual "zlim=c(0,30)" (which should
> only plot the z-values lying in the range from 0 to 30) did not work for
> the wireframe function of the lattice package.
> The call I tried was
>
> >library(lattice)
> >wireframe(z~x*y,zlim=c(0,30),drape=T,distance=0,colorkey=list(tick.number=6))
>
> Any hints are appreciated

If I understand you correctly, setting

z[z > 30] <- NA

before the call to wireframe may help.

Deepayan
--
http://www.stat.wisc.edu/~deepayan/

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html