How to change default position of RGL window in R?

50 views Asked by At

I am using Windows 11. I am plotting 3D stuff in R. When I want to see how the map is looking, an RGL windows pops up. However, it opens in the top left corner of the screen and the X button is hidden, like if the RGL window was too high. I have to make some extra steps to click on "X" if I want to close it or just rgl::rgl.close()

Title bar is not visible by default, I have to open the Task View to be able to close it by clicking in "X"

I think my problem would be solved if the default window would open in the center of the screen or even a little lower. How do I change its default position?

1

There are 1 answers

0
user2554330 On

You haven't shown us how you opened the window. If you're using open3d(), just specify windowRect. If you're opening the windows automatically, you can put windowRect in the r3dDefaults variable, e.g.

r3dDefaults <- list(windowRect = c(466L, 208L, 1019L, 659L))

If you want a different position, then move the window to the position you want, and run par3d("windowRect") to see the coordinates you've chosen.

Edited to add:

After looking more closely at the code image you posted, I think you're using the rayshader package to open the rgl window. That package overrides a lot of rgl defaults and the proposed solution may not work. That's why you should always post reproducible code when you ask a question: I would have checked my answer before posting.