rgl.spheres does not plot anything

Hi, I'm using RStudio 2022.12.0 Build 353 with "R version 4.2.2 (2022-10-31 ucrt)" on Windows10.
I do not succeed plotting spheres using the rgl 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 the website A complete guide to 3D visualization device system in R - R software and data visualization - Easy Guides - Wiki - STHDA

I can open the window and I can change the background to white. But the rgl.spheres command just does NOTHING.
Can anybody help??
I promise the above code is by far not the only version I have tried ....

What OS?

There have been a number of reports here suggesting some problems with RStudio 2022.12.0 Build 353, especially with Windows Your code seems to be working for me with R version 4.2.2 and RStudio 2022.07.2+576 "Spotted Wakerobin", under Ubuntu .

You might consider regressing to RStudio 2022.07.2+576 .

It looks like at the beginning of the guide, values are assigned to x, y, and z, which I don't see in the code you shared. In case you didn't assign these values, try the following, which works for me.

library(rgl)

x <- iris$Sepal.Length
y <- iris$Petal.Length
z <- iris$Sepal.Width

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

image

This topic was automatically closed 42 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.