Re: [R] colored 3d scatter plot

From: Uwe Ligges <ligges_at_statistik.tu-dortmund.de>
Date: Tue, 04 Mar 2008 10:20:18 +0100

SNN wrote:
>
>
> Hi All,
>
> I have data for two groups, group with 100 points and group B with 15
> points. i needed plot these two groups in one scatter plot, each group with
> a different color. I tried
>
> plot3d(data, col = c("red", "blue")[c(rep(1, 100), rep(2, 15))], pch=20) .
> this works but the graph does not look good.

I guess from package rgl?

> the other option that I tried is
>
> scatterplot3d(data, type="p", highlight.3d=T, pch=16) where the graph looks
> much nicer but i do not know how to have each group with a different color.

I guess from package scatterplot3d?

I'd do it that way for both packages:

library("rgl")
plot3d(iris, col = rep(c("red", "blue"), c(100, 15)), size = 3)

library("scatterplot3d")
scatterplot3d(data, color = rep(c("red", "blue"), c(100, 15)), pch=16)

Uwe Ligges

> Does anyone know how to do it?
> Thanks
>
>



R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Tue 04 Mar 2008 - 09:24:03 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Tue 04 Mar 2008 - 09:30:18 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive