R for
Authoring!!

OOH Session #45…
…parallax images

Open Office Hours
(October 01, 2024)

  • Recap session #44       ↔︎️
  • Focal issue(s):
    • Parallax images
  • Shared problem-solving

Recap of Session #44:

htmlwidgets (II)

library(plotly)

# custom grid style
axx <- list(
  gridcolor='rgb(255, 255, 255)',
  zerolinecolor='rgb(255, 255, 255)',
  showbackground=TRUE,
  backgroundcolor='rgb(230, 230,230)'
)

# individual plots
fig1 <- plot_ly(z = ~volcano, scene='scene1') 
fig1 <- fig1 %>% add_surface(showscale=FALSE)

fig2 <- plot_ly(z = ~volcano, scene='scene2') 
fig2 <- fig2 %>% add_surface(showscale=FALSE)

fig3 <- plot_ly(z = ~volcano, scene='scene3') 
fig3 <- fig3 %>% add_surface(showscale=FALSE)

fig4 <- plot_ly(z = ~volcano, scene='scene4') 
fig4 <- fig4 %>% add_surface(showscale=FALSE)

# subplot and define scene
fig <- subplot(fig1, fig2, fig3, fig4) 
fig <- fig %>% layout(title = "3D Subplots",
         scene = list(domain=list(x=c(0,0.5),y=c(0.5,1)),
                      xaxis=axx, yaxis=axx, zaxis=axx,
                      aspectmode='cube'),
         scene2 = list(domain=list(x=c(0.5,1),y=c(0.5,1)),
                       xaxis=axx, yaxis=axx, zaxis=axx,
                       aspectmode='cube'),
         scene3 = list(domain=list(x=c(0,0.5),y=c(0,0.5)),
                       xaxis=axx, yaxis=axx, zaxis=axx,
                       aspectmode='cube'),
         scene4 = list(domain=list(x=c(0.5,1),y=c(0,0.5)),
                       xaxis=axx, yaxis=axx, zaxis=axx,
                       aspectmode='cube'))

fig
library(widgetframe)

frameWidget(fig)
1
Note the “scrollability” difference between default and widgit-ized.

Today:

Parallax images

Session Info (October 01, 2024) Rendering:

R version 4.2.2 (2022-10-31 ucrt)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19045)

Matrix products: default

locale:
[1] LC_COLLATE=English_United States.utf8 
[2] LC_CTYPE=English_United States.utf8   
[3] LC_MONETARY=English_United States.utf8
[4] LC_NUMERIC=C                          
[5] LC_TIME=English_United States.utf8    

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

other attached packages:
[1] widgetframe_0.3.1 htmlwidgets_1.6.4 plotly_4.10.4     ggplot2_3.5.1    
[5] fontawesome_0.5.2

loaded via a namespace (and not attached):
 [1] compiler_4.2.2    pillar_1.9.0      tools_4.2.2       digest_0.6.31    
 [5] viridisLite_0.4.2 lubridate_1.9.3   jsonlite_1.8.9    evaluate_1.0.0   
 [9] lifecycle_1.0.4   tibble_3.2.1      gtable_0.3.5      timechange_0.3.0 
[13] pkgconfig_2.0.3   rlang_1.1.3       cli_3.6.0         rstudioapi_0.15.0
[17] crosstalk_1.2.0   yaml_2.3.10       xfun_0.42         emo_0.0.0.9000   
[21] fastmap_1.1.1     httr_1.4.7        withr_3.0.0       stringr_1.5.1    
[25] dplyr_1.1.4       knitr_1.45        generics_0.1.3    vctrs_0.6.5      
[29] grid_4.2.2        tidyselect_1.2.1  data.table_1.15.2 glue_1.6.2       
[33] R6_2.5.1          fansi_1.0.6       rmarkdown_2.28    farver_2.1.1     
[37] tidyr_1.3.1       purrr_1.0.1       magrittr_2.0.3    ellipsis_0.3.2   
[41] scales_1.3.0      htmltools_0.5.7   assertthat_0.2.1  colorspace_2.1-0 
[45] utf8_1.2.4        stringi_1.7.12    lazyeval_0.2.2    munsell_0.5.1    
[49] crayon_1.5.2