[R] Altering the cube around a wireframe plot.
Deepayan Sarkar
deepayan.sarkar at gmail.com
Sat Oct 11 01:20:21 CEST 2008
On Thu, Oct 9, 2008 at 8:59 AM, Todd Remund <tkremund98 at hotmail.com> wrote:
>
> I'm trying to create a 3D plot using wireframe with certain parts removed. I would like to get rid of the part of the outer cube that crosses over the plot leaving the back two walls and the axes. It would also be useful to put lines in the plot separate from the wireframe call. I've looked through the documentation and have not been able to find such a request. Here is my code attempting to rid the wireframe plot of some of the cube lines.
>
> trellis.par.set('axis.line', list(col='transparent'))trellis.par.set('box.3d', list(col='transparent'))
> wireframe(Data ~ Freqq*Time, scales=list(arrows=FALSE, cex=0.75, col='black', tck=1), screen=list(z=-10, x=-70, y=0), xlim=c(0, max(Freqq)), zoom=0.85, col='darkgrey', aspect=c(1.75,.65), xlab=list(label='Frequency (Hz)'), ylab='Time (Sec)', perspective=FALSE, zlab=list(label=expression(lb[f]), just=-1), par.box = list(col=c(1,1,NA,1,1,NA,1,1,1)))
> I found that the par.box option controls multiple lines in the plot not just one at a time. I have made some attempts at adding lines to the plot to put profile plots on the 'back walls', but don't know where to start. Thank you in advance.
>
Using 'par.box' will not get you far, for a couple of reasons. For one
thing, it does not allow separate parameters for different boundary
types. This is a shortcoming that should be fixed; however, that would
not help you because the wireframe model divides the edges slightly
differently: into those that are "behind" the plot (i.e., those that
may be obscured by the surface), and those that are "visible". The
"visible" ones includes the ones you want to omit, but also some you
want to keep.
The only reasonable approach I can think of is to make the box
transparent, and then draw the relevant lines yourself in a panel
function. This typically involves supplying a 'panel.3d.wireframe'
argument to wireframe; for an example, see
http://lmdvr.r-forge.r-project.org/figures/figures.html?chapter=13;figure=13_07
There are some relevant details in ?wireframe.
-Deepayan
More information about the R-help
mailing list