bokeh / rbokeh

R interface to Bokeh http://hafen.github.io/rbokeh/
Other
313 stars 67 forks source link

indefinite loading time of some plots #239

Open JauntyJJS opened 5 years ago

JauntyJJS commented 5 years ago

Hi,

I am using trelliscopejs with rbokeh for the first time and encountered some issues when i tried to create a trellis of around 740 pages with each page containing 4 scatter plots and each scatter plot has around 200 points

I have managed to created the webpage but there seems to be some plots that take an indefinite time to load

image

image

Strangely , when I display them one by one, they are fine

image

The json file size seems to be quite small as well image

Does this occurs because I have too much pictures to display ?

bryevdv commented 5 years ago

@hafen will have to comment definitively when he gets back later this month, but my guess is that trelliscope is similar to reveal.js slideshows, and everything is actually on one giant page with "virtual" subpages? If so I can definitely confirm that before Bokeh 1.1, ~3000 bokeh plots would take approximately infinite time to load. Even with 1.1, which dramatically improves some performance, a simple test case with 2800 plots took about a minute to run before raising the browser, then maybe another minute to finish rendering, and displayed a warning about the page taking up lots of memory. There's been asks to defer rendering of hidden Bokeh plots on occasion, so maybe this can be a concrete use case to spur that development

JauntyJJS commented 5 years ago

Hi,

Noted I will use the plotly graphs for now provided in https://ryanhafen.com/blog/trelliscopejs-plotly/ The plotly version did not give me any loading issues.

I realize that for the example using plotly, the function facet_trelliscope is used

Actually I wanted to ask if there is an example to use trelliscope because I want the trellis plots to be filtered by another column and the plotly hover to be customized

bryevdv commented 5 years ago

@hafen it occurs to me (when you are back) that the best thing here is actually probably to use the recent json_items bare JSON format, that could be async fetched using the new Bokeh.embed_item JS API:

https://bokeh.pydata.org/en/latest/docs/user_guide/embed.html#json-items

That would let you more easily load only what's visible at a time.

hafen commented 5 years ago

Thanks @bryevdv I'll check that out.

@JauntyJJS I haven't encountered this behavior before. Can you reproduce this with a simple sharable example? If so, if you could share reproducible code and your session info, I can look into it.

JauntyJJS commented 5 years ago

Hi,

The file and R code used are below Test_Script.zip

I apologize for the overplotting and failure to create a legend in rbokeh. I do not know how to do it

When the html file is created , some plots like CE17:0 and CE20:2 load indefinitely

image

This does not happen in the plotly example.

image

The session Info are as follows

R version 3.5.3 (2019-03-11)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 15063)

Matrix products: default

locale:
[1] LC_COLLATE=English_Singapore.1252  LC_CTYPE=English_Singapore.1252
[3] LC_MONETARY=English_Singapore.1252 LC_NUMERIC=C
[5] LC_TIME=English_Singapore.1252

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

other attached packages:
 [1] rbokeh_0.5.0         plotly_4.8.0         trelliscopejs_0.1.18
 [4] forcats_0.4.0        stringr_1.4.0        dplyr_0.8.0.1
 [7] purrr_0.3.2          readr_1.3.1          tidyr_0.8.3
[10] tibble_2.1.1         ggplot2_3.1.0        tidyverse_1.2.1

loaded via a namespace (and not attached):
 [1] httr_1.4.0              maps_3.3.0              jsonlite_1.6
 [4] viridisLite_0.3.0       modelr_0.1.4            shiny_1.2.0
 [7] assertthat_0.2.1        cellranger_1.1.0        yaml_2.2.0
[10] progress_1.2.0          pillar_1.3.1            backports_1.1.3
[13] lattice_0.20-38         glue_1.3.1              DistributionUtils_0.6-0
[16] digest_0.6.18           promises_1.0.1          pryr_0.1.4
[19] checkmate_1.9.1         rvest_0.3.2             colorspace_1.4-1
[22] htmltools_0.3.6         httpuv_1.5.0            plyr_1.8.4
[25] pkgconfig_2.0.2         broom_0.5.1             gistr_0.4.2
[28] haven_2.1.0             xtable_1.8-3            scales_1.0.0
[31] webshot_0.5.1           processx_3.3.0          later_0.8.0
[34] generics_0.0.2          withr_2.1.2             autocogs_0.1.2
[37] hexbin_1.27.2           lazyeval_0.2.2          cli_1.1.0
[40] magrittr_1.5            crayon_1.3.4            readxl_1.3.1
[43] mime_0.6                mclust_5.4.3            evaluate_0.13
[46] ps_1.3.0                nlme_3.1-137            xml2_1.2.0
[49] tools_3.5.3             data.table_1.12.0       prettyunits_1.0.2
[52] hms_0.4.2               munsell_0.5.0           callr_3.2.0
[55] packrat_0.5.0           compiler_3.5.3          rlang_0.3.3
[58] grid_3.5.3              rstudioapi_0.10         htmlwidgets_1.3
[61] crosstalk_1.0.0         base64enc_0.1-3         labeling_0.3
[64] rmarkdown_1.12          gtable_0.3.0            codetools_0.2-16
[67] R6_2.4.0                lubridate_1.7.4         knitr_1.22
[70] stringi_1.4.3           Rcpp_1.0.1              tidyselect_0.2.5
[73] xfun_0.5