1

I am using the packages rgl and plot3D to plot 3 dimensional data in a scatter plot. my data looks as follows:

install.packages("rgl")
library(rgl)

x <- Kg$GBMVP_SD
y <- Kg$GBMVP_Ret
z <- Kg$Asset_No

K<- as.matrix(Kg$GRN_No)
RF<- as.matrix(Kg$Risk_Free)


  scatter3D(x , y , z , colvar = K,
    pch = 16, cex = 1.5, xlab = "GMVP Standard Deviation", ylab = "GMVP Return",
    zlab = "Total No of Assets in Portfolio", clab = c("Green Asset No"),
    main = "Global Minimum Variance Portfolio(GMVP) Return and Standard Deviation vs No of Green Assets ", ticktype = "detailed",
    colkey = list(length = 0.5, width = 0.5, cex.clab = 0.75))

which gives me: enter image description here

I am trying to add a vertical plane to this where for x and z as specified above, the y is equal to RF, which is all one value. I have tried the rgl package with no luck, as all fit regression planes and when I use different z values in the plane as that specified for the scatter, it doesn't plot. I am trying to avoid using the scatterplot3d package due to the better graphics of the other packages, but will do if there is on other option. Any help is appreciated.

El_1988
  • 339
  • 3
  • 13

0 Answers0