[R] Controlling (number of) wires in wireframe

Deepayan Sarkar deepayan.sarkar at gmail.com
Sun Mar 5 03:07:41 CET 2006


On 3/4/06, Jan Marius Hofert <m_hofert at web.de> wrote:
> Hi,
>
> I would like to plot a wireframe (library: lattice) of the function f
> (x,y)=x*y where x and y are equally evaluated between 0 and 1.
> When one uses the option drape=TRUE then each "square" between the
> "wires" (lines that build the surface shape) gets a certain color. A
> perfect wireframe plot of a continuous surface would be, if you
> (almost) can not distinguish between the colors of those "squares"
> that lie adjacent to each other. So the idea would be, to choose many
> many evaluation points for x (and y), say x (and y) consists of 1000
> equally spaced intermediate points. But the problem is, that there
> are too many "wires" plotted... the whole picture is dark... On the
> other hand, if you use only 20 points for the x (and also y) axis,
> then you get a really nice wired frame, but the colors for each
> "square" differ a lot (if you do not think that they differ a lot
> then just think of plotting a different function and this "color-
> problem" appears again). So the solution would be, to choose many
> many values for x (and y) _but_ only to plot wires -say- every 10th
> time, the color changes, i.e. not to plot _all_ wires but only a
> subset (every 10th wire for example). Is that possible?? How??

It is certainly possible, by making appropriate changes in
'panel.3dwire' (and wherever else that leads). I don't think it would
be trivial, but R and lattice are Free Software, so you are welcome to
try.

You might alternatively consider using 'shade=TRUE', which allows
encoding of both height and orientation by color (rather than 'drape'
which encodes height by color and orientation by the `wires').

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




More information about the R-help mailing list