0
library(plot3D)
data(iris)
x <- sep.l <- iris$Sepal.Length
y <- pet.l <- iris$Petal.Length
z <- sep.w <- iris$Sepal.Width
CI <- list(z = matrix(nrow = length(x),
                      data = rep(0.1, 2*length(x))))
par(mfrow = c(1, 1))
scatter3D(x, y, z, phi = 0, bty = "g", col = gg.col(100), 
          pch = 18, CI = CI)

Running the above code gives me a scatter plot, but I can't seem to interact with it.

enter image description here

I know that the plot3d function from rgl package does have interactive 3D plots, but I didn't see an option to add confidence intervals.

library(rgl)
open3d()
plot3d(x, y, z, col = rainbow(1000))

Is there a way to create an interactive 3D plot with CIs?

IRTFM
  • 258,963
  • 21
  • 364
  • 487
Adrian
  • 9,229
  • 24
  • 74
  • 132
  • The `scatter3d` function is not part of pkg:`rgl`. It's not supposed to be an interactive plot. Furthermore the scatterplot3d package is not being used here so am removing that tag. – IRTFM Dec 29 '21 at 23:23
  • I think `plot3Drgl` uses the `rgl` package. Use function `scatter3Drgl` instead of `scatter3D`. – user2554330 Dec 29 '21 at 23:27
  • @IRTFM Yes, but I can't seem to find a function/package that does both: i.e., interactive and can plot confidence intervals. I've found functions that only do one or the other. Or so it seems. – Adrian Dec 29 '21 at 23:35
  • CI's are typically plotted in base graphics with the `arrow` functon. There is an arrow in rgl. – IRTFM Dec 30 '21 at 00:57
  • I see CIs in `scatter3Drgl`. – user2554330 Dec 30 '21 at 01:10

0 Answers0