tylermorganwall / rayshader

R Package for 2D and 3D mapping and data visualization
https://www.rayshader.com/
2.06k stars 214 forks source link

RGL device hangs on plot_gg() #73

Closed yabmtm closed 3 years ago

yabmtm commented 5 years ago

I'm fairly new to R, but managed to get a working R environment running in a Jupyter notebook. I'm able to plot my dataset with ggplot2 just fine, but plot_gg hangs at the same point after loading the X window. I've attached an image for reference. I can supply extra environment information if you let me know what to do. Thanks. 2019-08-25-142240_1375x887_scrot

tylermorganwall commented 5 years ago

Does rgl work? What happens when you run this example rgl code?

open3d()
x <- sort(rnorm(1000))
y <- rnorm(1000)
z <- rnorm(1000) + atan2(x, y)
plot3d(x, y, z, col = rainbow(1000))
yabmtm commented 5 years ago

I think so, although it's still a little strange in that I still have to kill the process if I want to close the window Here's another screenshot of the output (including the cell above the previous screenshot with the data I'm trying to render with rayshader): 2019-08-28-101542_974x584_scrot

tylermorganwall commented 5 years ago

What happens when you decrease the size of the ggplot? E.g. plot_gg(..., width=4, height=4). I'm wondering if the pane is just hanging due to the size of the 3D model.

yabmtm commented 5 years ago

Tried this, but same result as the first screenshot. I also tried running it from command line via Rscript, which produces the same result, but the window closes after a second with no error message. The full script was:

library(rayshader)
library(ggplot2)
library(sf)
library(viridis)
library(readr)
library(RcppCNPy)
library(rgl)

tica1 <- npyLoad('tica/tica1.npy')
tica2 <- npyLoad('tica/tica2.npy')

a = data.frame(x=tica1, y=tica2)

tica_1_2 = ggplot(a, aes(x=x, y=y)) +
  geom_hex(bins = 50, size = 0.5, color = "black") +
  scale_fill_viridis_c(option = "C")

plot_gg(tica_1_2, multicore = TRUE, width = 4, height = 4, scale = 1, 
          zoom = 0.6, phi = 60,
          background = "#afceff",shadowcolor = "#3a4f70")
tylermorganwall commented 3 years ago

I haven't seen this from anyone else so far, so I'm assuming this is is a local installation issue. I would recommend reinstalling rgl and making sure all your libraries are updating if you're still having issues.