Scatter3d {car} - Axis scaling scale

I've searched high and low on the net and on StackOverflow, but I can't seem to figure out how to set up the axes in disp3d.

My example code

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")
})

      

Based on the above, I would like all three axes to cover a common range. I assumed xlim = c (low, high) would work, but it is not recognized.

Any help would be appreciated.

Greetings.

+3


source to share





All Articles