On Friday 30 January 2004 06:13, Pascal A. Niklaus
wrote:> Hi all,
>
> I'd like to plot a set of data (x,y,z) as 3D-cloud, and add several
line
> plots to the same 3D graph:
>
> Two questions:
>
> 1) How do I connect points to get a line?
>
> > cloud(z~x*y,data=d,zlim=c(0,1)) # works
> > cloud(z~x*predict(l),data=d,zlim=c(0,1),type="l") #
type="l" doesn't
>
> Warning message:
> type = l not implemented, consider using 'panel.3d.cloud >
panel.3dscatter.old' in: panel.3d.cloud(x = x, y = y, z = z, rot.mat >
rot.mat, za = za,
Well, have you considered taking the hint and try
cloud(z~x*predict(l),data=d,zlim=c(0,1),type="l",
panel.3d.cloud = panel.3dscatter.old)
?
> help.search("panel.3d.cloud") also didn't report any hits.
panel.3d.cloud is the name of an argument to the panel.cloud function.
See ?panel.cloud for details. (Unfortunately, the docs are a bit outdated).
Briefly, panel.3dscatter.old is a very simple function, that calculates the 2D
projections of the given 3D points and then calls panel.xyplot with those.
Any 'type' argument which works with panel.xyplot would also work here,
including 'p' and 'l'. But no consideration is made of the fact
that these
are 3D data. For instance, type = 'h' would not give you what you would
expect.
panel.3dscatter (the newer version) is a bit more sophisticated. For type =
'p', it draws the points in order of increasing depth, so that closer
points
overwrite distant ones. Unfortunately, a collection of line segments is not
well ordered, and I haven't decided yet what to do in that case (which is
why
the older version is still retained).
> 2) How do I superimpose a second data set onto the same graph?
>
> (something equivalent to the sequence plot(), followed by points() or
> lines() in the base plotting functions)
I'm not sure what you mean. Trellis plots are not supposed to be used for
two
unrelated data sets, they are typically very much dependent on the structure
of the data set. Maybe we could help if you give more details of what exactly
you want to do, but before that you should read the ?panel.cloud help page
carefully, since anything 'special' would almost invariably involve
playing
with things documented there.
Hth,
Deepayan