[R] question about cleaning up data labels on a plot3d plot
LMH
lmh_users-groups at molconn.com
Wed Aug 24 07:57:17 CEST 2016
Hello,
I am rather unfamiliar with R but need a 3D plot for something I am working on.
I was able to generate a plot with the following,
library(rgl)
setwd("G:/shared_data/R_projects/3D_plot")
df <- read.table("R_input_3D_PCA-3_RI9_60.txt", header = TRUE)
plot3d(df$PCA_Axis1, df$PCA_Axis2, df$PCA_Axis3, col="blue", size=10)
My data is tab delimited and looks like,
num PCA_Axis1 PCA_Axis2 PCA_Axis3
11 -0.672164 -0.83449 -1.06511
12 -1.23009 1.57928 -0.066808
42 2.80029 0.533236 -0.197187
60 2.25999 -0.233224 -0.00267827
67 1.82422 -0.840649 0.156681
There are a total of 60 rows.
Adding,
text3d(df, text=df$num)
displays my index value on the plot, but the numbers are very hard to read. It looks
like the the labels are behind the points. Is there any way to clean this up some? I
guess I could color the points white so I only see the numbers.
I also have 2 or three different sub groups within the data. Is there any way to have
these different groups appear in different colors? I could create multiple
data.frames if that would help. I am not sure you can display data from multiple
frames on the same plot.
Suggestions would be appreciated,
LMH
More information about the R-help
mailing list