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

Issue with rgl.spheres and spheres3d #289

Closed uwemenzel closed 1 year ago

uwemenzel commented 1 year ago

Hi, thank you very much for providing the rgl package. While many things work perfectly for me, I unfortunately also encountered some issues. I do not suceed plotting spheres using the package. For example, I use the code snippet rgl.open() # Open a new RGL device rgl.bg(color = "white") # Setup the background color rgl.spheres(x, y, z, r = 0.2, color = "grey") taken from http://www.sthda.com/english/wiki/a-complete-guide-to-3d-visualization-device-system-in-r-r-software-and-data-visualization

I can open the window and I can change the background to white. But the rgl.spheres command just does not do anything. I also noticed that there is no description of rgl.spheres in the documentation. The same is valid for spheres3d. It just does not plot anything, and no error messages appears. I have updated the package and all dependencies by running install.packages("rgl", dep = TRUE), which worked without problems. I'm using RStudio 2022.12.0 Build 353 with "R version 4.2.2 (2022-10-31 ucrt)" on Windows10. AMD Ryzen 7 5700U with Radeon Graphics 64-bit operating system, x64-based processor 16,0 GB (15,4 GB usable) rgl version ‘0.110.2’ Any help is appreciated!

dmurdoch commented 1 year ago

You shouldn't be using the obsolete functions rgl.open, rgl.bg or rgl.spheres. The web page you link to is quite out of date, but I don't see a way to leave a comment for the author. If you know one, could you please pass on this message to them?

The supported way to do those steps is to run

open3d() # Open a new RGL device
# bg3d(color = "white") # white is the default, you don't need this
spheres3d(x, y, z, r = 0.2, color = "grey")

You can read more about the changes here: https://github.com/dmurdoch/rgl/blob/deprecated/vignettes/deprecation.Rmd .

uwemenzel commented 1 year ago

open3d() # Open a new RGL device spheres3d(x, y, z, r = 0.2, color = "grey")

Thanks a lot, Duncan, for the quick answer. However, even with the code above (and specifying x,y,z before), I have the same issue. (I tried this before, even in the usual Windows R environment in order to exclude that this is an RStudio issue). I'm really sorry to say that ..

dmurdoch commented 1 year ago

I think you'll need to show me x, y, and z then so I have reproducible example.

uwemenzel commented 1 year ago

Hi,

for example:

library(rgl) open3d() # Open a new RGL device x = rnorm(5) y = 3rnorm(5,2) z = 2rnorm(5,2) spheres3d(x, y, z, r = 0.2, color = "grey")

Best, Uwe

On Mon, Jan 2, 2023 at 2:34 PM dmurdoch @.***> wrote:

I think you'll need to show me x, y, and z then so I have reproducible example.

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

dmurdoch commented 1 year ago

That works fine for me. Please try installing the devel version using

remotes::install_github("dmurdoch/rgl")

It should appear on CRAN in a week or two. If that's not enough to fix the issue, it might be a problem specific to your hardware. As a workaround, you should still be able to use rglwidget() to have things display in a browser or the RStudio Viewer window instead.

uwemenzel commented 1 year ago

Okay, thanks!! Best, Uwe

On Mon, Jan 2, 2023 at 5:06 PM dmurdoch @.***> wrote:

That works fine for me. Please try installing the devel version using

remotes::install_github("dmurdoch/rgl")

It should appear on CRAN in a week or two. If that's not enough to fix the issue, it might be a problem specific to your hardware. As a workaround, you should still be able to use rglwidget() to have things display in a browser or the RStudio Viewer window instead.

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

dmurdoch commented 1 year ago

I am closing this now, as I couldn't reproduce it. If it is still happening or starts again, please comment here and reopen it.

uwemenzel commented 1 year ago

Okay, thanks!

On Fri, Jan 27, 2023 at 6:52 PM dmurdoch @.***> wrote:

I am closing this now, as I couldn't reproduce it. If it is still happening or starts again, please comment here and reopen it.

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