[R] question about cloud() in lattice package

Rishabh Gupta rg117 at ohm.york.ac.uk
Mon Aug 12 22:50:04 CEST 2002


Hi all,
I have been previously been using scatterplot3d package to create some graphs but unfortunately it does not allow me to rotate the
plot on all three axis. The cloud() function in the lattice package does allow me to do so. When I was using scatterplot3d I was
using a script (Shown Below) to calculate the mean, quartiles and range limits for all three axis and I was representing that on the
plot (like a 3d version of the boxplot() function). I was just wondering whether there is any way of representing such information
with the cloud() function. Is there a way I can draw lines along each axis on the plot.
Any help would be greatly appreciated.

Many Thanks

Rishabh



THE SCRIPT:

s3d <- scatterplot3d(x, y, z, type="n", xlab="x", ylab="y", zlab="z")
for (g in unique(G))
{
    bxp.stx <- boxplot.stats(x[G==levels(G)[g]])
    bxp.sty <- boxplot.stats(y[G==levels(G)[g]])
    bxp.stz <- boxplot.stats(z[G==levels(G)[g]])

    lines(s3d$xyz.convert(bxp.stx$stats[c(3, 3)], bxp.sty$stats[c(3, 3)], bxp.stz$stats[c(1, 5)]))
    lines(s3d$xyz.convert(bxp.stx$stats[c(3, 3)], bxp.sty$stats[c(1, 5)], bxp.stz$stats[c(3, 3)]))
    lines(s3d$xyz.convert(bxp.stx$stats[c(1, 5)], bxp.sty$stats[c(3, 3)], bxp.stz$stats[c(3, 3)]))

    lines(s3d$xyz.convert(bxp.stx$stats[c(3, 3)], bxp.sty$stats[c(3, 3)], bxp.stz$stats[c(2, 4)]), lwd = 3)
    lines(s3d$xyz.convert(bxp.stx$stats[c(3, 3)], bxp.sty$stats[c(2, 4)], bxp.stz$stats[c(3, 3)]), lwd = 3)
    lines(s3d$xyz.convert(bxp.stx$stats[c(2, 4)], bxp.sty$stats[c(3, 3)], bxp.stz$stats[c(3, 3)]), lwd = 3)

    s3d$points3d(bxp.stx$stats[3], bxp.sty$stats[3], bxp.stz$stats[3], pch = 18, col = "red")
}


Where,
    x, y, z are the list of values along each axis
    G is the Group variable

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list