Assigning colors to the groups

22 Views Asked by At

I'm making PCA graphs for my expression data.

2D PCA are working fine with ggplot2 package.

I'm using scatterplot3d for 3D PCA, but keep getting an error.

When I use this code, I'm getting the graph with black dots:

s3d <- with(combined_data_2d, scatterplot3d(PC1, PC2, PC3, pch=20, cex.symbols = 3, angle = 65, col.grid="grey", y.margin.add=1.35, main="2D post SE"))

When I'm trying to use color codes for my grups, I keep getting an error:

s3d <- with(combined_data_2d, scatterplot3d(PC1, PC2, PC3, color = colors[as.data.frame(combined_data_2d$group)], pch=20, cex.symbols = 3, angle = 65, col.grid="grey", y.margin.add=1.35, main="2D post SE"))

I get an error:

Error in colors[as.data.frame(combined_data_2d$group)] : invalid subscript type 'list'

Any advice how to fix this?

I must add that this code used to work fine for me.

0

There are 0 best solutions below