plotly / plotly/plotly.R

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

未关闭
#2,243 4 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

主要语言
R
星标
2.7k
派生
641
PR 合并指标
30 天内没有已合并 PR

描述

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

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

首先,在报告的 Ubuntu 环境中使用 plotly 4.10.0 重现 save_image(fig, "test.pdf") 示例,然后将 R 导出路径与 plotly.py 的 issue 3469 进行比较。检查 webshot2 和 chromote 如何处理 MathJax 加载页面。PDF 导出在没有加载框的情况下完成,并且该行为由适当的回归检查覆盖,即视为完成。

由索引模型根据 Issue 内容生成。

评估

技术栈
javascript, r
领域
data-visualization
Issue 类型
缺陷
难度
4/5
预计耗时
3-5 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
35/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。