dmurdoch / rgl

rgl is a 3D visualization system based on OpenGL. It provides a medium to high level interface for use in R, currently modelled on classic R graphics, with extensions to allow for interaction.
https://dmurdoch.github.io/rgl/
GNU General Public License v2.0
85 stars 20 forks source link

rgl does not draw lines with lines3d #328

Closed uwemenzel closed 1 year ago

uwemenzel commented 1 year ago

Hi, thank you for providing rgl. I'm having a small issue using lines3d in the package:

library(MASS)
library(rgl)
set.seed(77)
mu <- c(1, 3, 2)   ## means
Sigma <- matrix(c(3.0, 1.5, 1.0, 1.5, 2.0, 0.5, 1.0, 0.5, 1.0),  nrow = 3, byrow = TRUE)  ## covariance matrix
d3 <- mvrnorm(n = 500, mu = mu, Sigma = Sigma)  ## sample
from <- c(1, 3, 2)
to <- c(2, 2, 1)
par3d(windowRect = c(819, 88, 1492, 706))  
plot3d(d3[, 1], d3[, 2], d3[, 3], col = "blue", size = 5, xlab = "x", ylab = "y", zlab = "z", aspect = c(1, 1, 1))
points3d(from[1], from[2], from[3], col = "red", size = 10)
points3d(to[1], to[2], to[3], col = "red", size = 10)
lines3d(c(from[1], to[1]),  c(from[2], to[2]), c(from[3], to[3]), col="red", lwd = 10) 

Everything works except for the last command. What am I missing here? I just do not see a line but I don't get an error message either. Any hint is appreciated.

R version 4.2.2 (2022-10-31 ucrt) Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows 10 x64 (build 19045)

dmurdoch commented 1 year ago

I get a line from your code, so I really don't know. What version of rgl are you using?

dmurdoch commented 1 year ago

If you run rglwidget() at the end, do you get the correct display in your browser?

uwemenzel commented 1 year ago

I use rgl_0.110.2 and MASS_7.3-58.1 It works when I use rglwidget() , i.e. the line is shown on the page that opens in the browser window, not in the separate window that opens after the par3d command. This is okay for me, thanks a lot for the fast answer!!

dmurdoch commented 1 year ago

That's not the current version of rgl, so you might get better results if you update. You could even try the Github version, though it's not the easiest package to build.

If those don't work, you might want to look at your graphics drivers. This appears to be a problem there, and often video card manufacturers make updates available.

uwemenzel commented 1 year ago

Thanks a lot !! Best regards, Uwe

On Mon, Mar 6, 2023 at 5:22 PM dmurdoch @.***> wrote:

That's not the current version of rgl, so you might get better results if you update. You could even try the Github version, though it's not the easiest package to build.

If those don't work, you might want to look at your graphics drivers. This appears to be a problem there, and often video card manufacturers make updates available.

— Reply to this email directly, view it on GitHub https://github.com/dmurdoch/rgl/issues/328#issuecomment-1456444848, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADNAPQPSKXODSHZCF53S6NDW2YFNBANCNFSM6AAAAAAVQJVMEE . You are receiving this because you authored the thread.Message ID: @.***>

dmurdoch commented 1 year ago

I'm closing this because it seems unlikely to be caused by rgl.