我在网上和StackOverflow中搜索过高低,但我无法找到如何调整scatter3d中的轴。
我的示例代码是
library(mvtnorm)
library(rgl)
library(car)
# multivariate norm data, split into two groups
set.seed(41367)
sigma <- matrix(c(9,2,0,2,4,1,0,1,1), ncol=3)
pcaData <- data.frame(rmvnorm(n=100, mean=c(9,4,0), sigma=sigma), gl(2,50))
names(pcaData)<-c("PC1", "PC2", "PC3", "ID")
# Obtain overall min and max across all numerical data
minScale <- min(pcaData[,1:3]) # = -1.883 from 3rd column
maxScale <- max(pcaData[,1:3]) # = 16.309 from 1st column
with(pcaData,{
scatter3d(PC1, PC2, PC3, surface=F, groups = ID, ellipsoid = T, grid = F,
axis.scales = T,
xlim = c(minScale, maxScale),
ylim = c(minScale, maxScale),
zlim = c(minScale, maxScale),
xlab = "PC-1",
ylab = "PC-2",
zlab = "PC-3")
})
基于以上所述,我希望所有三个轴都跨越一个共同的范围。我认为xlim = c(低,高)会起作用,但它不被识别。
任何帮助都将不胜感激。
干杯。