我已经制作了 3d 散点图,但我希望每个点的颜色不同且形状不同
我使用的代码
NB = read.csv("PCA_LuoyuanBay.csv")
head(NB)
library(scatterplot3d)
zz <- scatterplot3d(NB[,2:3],
xlab = "PC-1", ylab = "PC-2", zlab = "PC-3",
pch = 16, color = "blue", grid = TRUE)
zz.coords <- zz$xyz.convert(NB[,2:3])
text(zz.coords$x,
zz.coords$y,
labels = NB[,1],
cex = .5,
pos = 4)
我用于此分析的数据。
dput(Mydata)
结构(列表(污染物 = c(“石油”,“硫化物”,“PAH”,“OCP”,“PES”,“丙烯酸”,“PP”,“人造丝”),PC1 = c(0.403932362147421,0.555044525557921,0.076054416943299 , -0.0720241904196998, 0.447560520426065, 0.0568903915498196, -0.259187304098997, 0.497058817862777), PC2 = c(-0.455434537323988, -0.29106034461361, 0.342721781548768, 0.117145627891435, 0.408367154179987, 0.506743327637759, -0.390124826686555, 0.0305291206586067), PC3 = c(0.0862562754659925, -0.0387696672317506, 0.574038320104521, - 0.721513535016868, 0.158526945855976, -0.108410486624353, 0.222722390860155, -0.233379742311754), PC4 = c(-0.314407751462903, -0.134408332997354, 0.169766921910276, -0.0832028345129114, -0.164199259363002, -0.696041503283991, -0.456572272090939, 0.356994727809195), PC5 = c(0.0161942986358165, 0.015757794327504, 0.598159844933004, 0.558520586006352, -0.029362526526301, -0.118504522623422, 0.498083095703882, 0.258373259944396), PC6 = c(0.518412858988302, -0.0191704059743438, 0.361419582163633, 0.24044643261062, -0.329200673343559, 0.0430271919863158, -0.521248888676183, -0.400645947586656), PC7 = c(0.151901296559833, -0.205320742751646, -0.144538332512259, 0.265500760968266, 0.686586857523377, -0.46642589723511, 0.0106988593210088, -0.392833691188813), PC8 = c(0.480663601925481, -0.738151978534111, -0.0954256850387164, -0.115475274210577, 0.0140322623771219, 0.10149037686373, 0.0515695472255115, 0.434162341603549)), class = "data.frame ", row.names = c(NA, -8L))PC6 = c(0.518412858988302, -0.0191704059743438, 0.361419582163633, 0.24044643261062, -0.329200673343559, 0.0430271919863158, -0.521248888676183, -0.400645947586656), PC7 = c(0.151901296559833, -0.205320742751646, -0.144538332512259, 0.265500760968266, 0.686586857523377, -0.46642589723511, 0.0106988593210088, -0.392833691188813), PC8 = c(0.480663601925481, -0.738151978534111, -0.0954256850387164, -0.115475274210577, 0.0140322623771219, 0.10149037686373, 0.0515695472255115, 0.434162341603549)), class = "data.frame", row.names = c(NA, -8L))PC6 = c(0.518412858988302, -0.0191704059743438, 0.361419582163633, 0.24044643261062, -0.329200673343559, 0.0430271919863158, -0.521248888676183, -0.400645947586656), PC7 = c(0.151901296559833, -0.205320742751646, -0.144538332512259, 0.265500760968266, 0.686586857523377, -0.46642589723511, 0.0106988593210088, -0.392833691188813), PC8 = c(0.480663601925481, -0.738151978534111, -0.0954256850387164, -0.115475274210577, 0.0140322623771219, 0.10149037686373, 0.0515695472255115, 0.434162341603549)), class = "data.frame", row.names = c(NA, -8L))-0.392833691188813), PC8 = c(0.480663601925481, -0.738151978534111, -0.0954256850387164, -0.115475274210577, 0.0140322623771219, 0.10149037686373, 0.0515695472255115, 0.434162341603549)), class = "data.frame", row.names = c(NA, -8L))-0.392833691188813), PC8 = c(0.480663601925481, -0.738151978534111, -0.0954256850387164, -0.115475274210577, 0.0140322623771219, 0.10149037686373, 0.0515695472255115, 0.434162341603549)), class = "data.frame", row.names = c(NA, -8L))