plotly / plotly/plotly.R

Write Image as PDF with Box saying "Loading [MathJax]/extensions/MathMenu.js"

Open
#2,243 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
R
Stars
2.7k
Forks
641
PR merge metrics
No merged PRs in 30d

Description

Hello,

library(plotly)

n <- 1e3
x <- rnorm(n)
y <- 2*x + rnorm(n, sd = 5)

fig <- plot_ly(x = x, y = y, alpha  = 0.01,type = "scatter")

save_image(fig,"test.pdf")
browseURL("test.pdf")

image
When I run the above code, I get the box saying Loading [MathJax]/extensions/MathMenu.js,I see the Solution in plotly.py issues 3469:

import plotly.io as pio   
pio.kaleido.scope.mathjax = None

How should I solve it in R?

My sessionInfo is:

> sessionInfo()
R version 4.2.0 (2022-04-22)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 20.04.4 LTS

Matrix products: default
BLAS:   /usr/lib/x86_64-linux-gnu/openblas-pthread/libblas.so.3
LAPACK: /usr/lib/x86_64-linux-gnu/openblas-pthread/liblapack.so.3

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C               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    LC_PAPER=en_US.UTF-8       LC_NAME=C                 
 [9] LC_ADDRESS=C               LC_TELEPHONE=C             LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       

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

other attached packages:
 [1] plotly_4.10.0        webshot2_0.1.0       RefManageR_1.4.0     knitcitations_1.0.12 shinyWidgets_0.7.5  
 [6] ggplot2_3.4.0        maftools_2.12.0      shinyjqui_0.4.1      shinyFeedback_0.4.0  bslib_0.4.2         
[11] htmltools_0.5.4      shiny_1.7.4         

loaded via a namespace (and not attached):
 [1] httr_1.4.3         sass_0.4.4         tidyr_1.2.0        jsonlite_1.8.4     viridisLite_0.4.0  splines_4.2.0     
 [7] here_1.0.1         assertthat_0.2.1   yaml_2.3.5         pillar_1.7.0       backports_1.4.1    lattice_0.20-45   
[13] glue_1.6.2         reticulate_1.25    digest_0.6.31      RColorBrewer_1.1-3 promises_1.2.0.1   colorspace_2.0-3  
[19] websocket_1.4.1    httpuv_1.6.7       Matrix_1.5-1       plyr_1.8.7         pkgconfig_2.0.3    bibtex_0.5.1      
[25] purrr_1.0.1        xtable_1.8-4       scales_1.2.0       processx_3.7.0     fontawesome_0.4.0  later_1.3.0       
[31] tibble_3.1.7       generics_0.1.2     ellipsis_0.3.2     cachem_1.0.6       withr_2.5.0        lazyeval_0.2.2    
[37] cli_3.5.0          survival_3.3-1     magrittr_2.0.3     crayon_1.5.2       mime_0.12          ps_1.7.0          
[43] fansi_1.0.3        xml2_1.3.3         tools_4.2.0        data.table_1.14.2  lifecycle_1.0.3    stringr_1.5.0     
[49] munsell_0.5.0      compiler_4.2.0     jquerylib_0.1.4    chromote_0.1.1     rlang_1.0.6        grid_4.2.0        
[55] rstudioapi_0.13    rappdirs_0.3.3     htmlwidgets_1.6.1  crosstalk_1.2.0    DNAcopy_1.70.0     gtable_0.3.0      
[61] DBI_1.1.2          R6_2.5.1           lubridate_1.8.0    dplyr_1.0.9        fastmap_1.1.0      utf8_1.2.2        
[67] rprojroot_2.0.3    stringi_1.7.8      Rcpp_1.0.9         vctrs_0.5.2        png_0.1-7          tidyselect_1.2.0

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the save_image(fig, "test.pdf") example with plotly 4.10.0 on the reported Ubuntu setup, then compare the R export path with plotly.py issue 3469. Inspect how webshot2 and chromote handle the MathJax loading page. Done means PDF export completes without the loading box and the behavior is covered by an appropriate regression check.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, r
Domain
data-visualization
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.