[R] Two questions about cloud().

Deepayan Sarkar deepayan.sarkar at gmail.com
Thu Nov 5 06:49:08 CET 2009


On Tue, Nov 3, 2009 at 3:57 PM, Rolf Turner <r.turner at auckland.ac.nz> wrote:
>
>
> (1) Is there a (simple) way of getting cloud() to do *both*
> type="p" and type="h"?  I.e. of getting it to plot the points
> as points *and* drop a perpendicular line to the underlying plane?

Yes, 'type' can be a vector, similar to the behaviour in xyplot():

cloud(Sepal.Length ~ Petal.Length * Petal.Width, data = iris, type =
c("p", "h"))

> (2) Is there a way of telling cloud() to drop its lines to the
> floor of the bounding box, rather than to the plane z=0?
> I thought that the "zero.scaled" argument (for panel.3dscatter())
> might be the ticket here, but when I pass this argument to cloud()
> I get an error ``Error using packet 1 formal argument "zero.scaled"
> matched by multiple actual arguments".

There doesn't seem to be an easy way. (To use 'zero.scaled', you would
need a custom panel.3d.cloud argument which captures 'zero.scaled' and
replaces it, etc., which is not really what you should need to do.)

Unless you are using arrows=FALSE on the z-axis, you could easily fake
it by increasing the z-values (e.g., z-min(z)).

Longer term, I could add an 'origin' argument to panel.cloud, similar
to what panel.barchart supports. Would that suffice for you? You would
still need to pre-compute the origin, in this case the lower zlim.

-Deepayan




More information about the R-help mailing list