tylermorganwall / rayshader

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

another instance of `Error in hillshade[, , 1] ...` #195

Closed jwhendy closed 3 years ago

jwhendy commented 3 years ago

I'm brand new to rayshader and am simply looking to apply this to ggplot output, failing with a similar error to that mentioned in #46 . That said, I'm not trying to bring in a specific sized image, just add the rayshader magic to ggplot. I thought it was something in my actual data, but found I couldn't reproduce the mtcars example on your site, either.

library(ggplot2)
library(rayshader)
mtplot = ggplot(mtcars) +
  geom_point(aes(x = mpg, y = disp, color = cyl)) +
  scale_color_continuous(limits = c(0, 8))
plot_gg(mtplot, width = 3.5, multicore = TRUE, windowsize = c(800, 800),
        zoom = 0.85, phi = 35, theta = 30, sunangle = 225, soliddepth = -100)

Error in hillshade[, , 1] * scales::rescale(shadowmap, c(max_darken, 1)) : 
  non-conformable arrays

> sessionInfo()
R version 4.1.1 (2021-08-10)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Arch Linux

Matrix products: default
BLAS:   /usr/lib/libblas.so.3.10.0
LAPACK: /usr/lib/liblapack.so.3.10.0

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C              
 [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8    
 [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8   
 [7] LC_PAPER=en_US.UTF-8       LC_NAME=C                 
 [9] LC_ADDRESS=C               LC_TELEPHONE=C            
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] rayshader_0.24.10 ggplot2_3.3.5    

loaded via a namespace (and not attached):
 [1] Rcpp_1.0.7        pillar_1.6.2      compiler_4.1.1    prettyunits_1.1.1
 [5] iterators_1.0.13  tools_4.1.1       progress_1.2.2    extrafont_0.17   
 [9] digest_0.6.27     jsonlite_1.7.2    lifecycle_1.0.0   tibble_3.1.4     
[13] gtable_0.3.0      png_0.1-7         pkgconfig_2.0.3   rlang_0.4.11     
[17] foreach_1.5.1     DBI_1.1.1         parallel_4.1.1    xfun_0.26        
[21] fastmap_1.1.0     Rttf2pt1_1.3.9    knitr_1.34        withr_2.4.2      
[25] dplyr_1.0.7       generics_0.1.0    vctrs_0.3.8       htmlwidgets_1.5.4
[29] hms_1.1.0         grid_4.1.1        tidyselect_1.1.1  glue_1.4.2       
[33] R6_2.5.1          fansi_0.5.0       rgl_0.107.14      farver_2.1.0     
[37] extrafontdb_1.0   purrr_0.3.4       magrittr_2.0.1    scales_1.1.1     
[41] codetools_0.2-18  ellipsis_0.3.2    htmltools_0.5.2   assertthat_0.2.1 
[45] rayimage_0.6.2    colorspace_2.0-2  labeling_0.4.2    utf8_1.2.2       
[49] munsell_0.5.0     doParallel_1.0.16 crayon_1.4.1

Thanks for any pointers!

jwhendy commented 3 years ago

Bah. I missed #176 (or #181) and did not realize this was so recent. Using your tip and installing from github indeed fixed the issue. Sorry for the noise. I haven't fixed it yet (can't get rayrender to compile), but think that's probably the issue.