[R] Plotting separate populations in scatterplot3d

Eleca Dunham ejd162 at psu.edu
Tue May 6 19:40:36 CEST 2008


Hi,

I'm having trouble plotting populations as separate colors and points in the
3d scatterplot package. I have a column with 4 different population names
and 3 columns with my data. I want to plot each population with a different
color and pch. In addition, I want to use the type="h" in my plotting so
that I can see the points clearly in my graph( for publication purposes).
I've also attached an example dataset.

I simply want to show that each population clusters separately in space.

I've attached a visual representation of what I want my data to look like.
The scripts for this graph is as follows:

data(trees) 
s3d <- scatterplot3d(trees, type = "h", color = "blue",
angle = 55, scale.y = 0.7, pch = 16, main = "Adding elements")

For some reason, R will not read my header, so I had to use the data.frame
function to get R to read my data. This is a real pain because I have tons
of data. I've tried the following to get R to recognize each population type
separately:

PopulationType.LK1<-PopulationType[LK1]
PopulationType.LK2<-PopulationType[LK2]....
points((PopulationType.LK1, col="red", pch=19), (PopulationType.LK2,
col="blue", pch=22), .....)

When I tweak the example tree code from above, R will plot all of my data no
problem (with the rgl 3d graphs, not scatterplot3d), but only with one color
and plotting character. It seems pretty straightforward, but I've spent 4
days on this already.



Any help would be greatly appreciated.

Regards,
EJ




More information about the R-help mailing list