问题描述
我正在包装Snakemake管道所需的软件。其中包括R 4.0.2安装以及Tidyverse和一些Bioconductor软件包(全部通过Conda Forge)。大多数情况下,一切似乎都可以正常工作,但是,只需一步就可以通过knitr::render
渲染.Rmd文档。文档渲染运行没有错误,但是HTML中的ggplot图片缺少所有标签:
当我在同一台计算机上的Conda环境中运行此代码时,它可以正常工作。我怀疑是否需要一些库来在需要在Docker容器中安装的图像中渲染文本。 以前有没有人经历过?我需要添加到容器中的特定库来解决此问题吗?
The container image是公开的,如果有人想对其进行测试。
其他信息
会话信息
这是呈现的HTML的sessionInfo()
输出。
## R version 4.0.2 (2020-06-22)
## Platform: x86_64-conda_cos6-linux-gnu (64-bit)
## Running under: Debian GNU/Linux 10 (buster)
##
## Matrix products: default
## BLAS/LAPACK: /opt/conda/lib/libopenblasp-r0.3.10.so
##
## locale:
## [1] LC_CTYPE=C.UTF-8 LC_NUMERIC=C LC_TIME=C.UTF-8
## [4] LC_COLLATE=C.UTF-8 LC_MONETARY=C.UTF-8 LC_MESSAGES=C.UTF-8
## [7] LC_PAPER=C.UTF-8 LC_NAME=C LC_ADDRESS=C
## [10] LC_TELEPHONE=C LC_MEASUREMENT=C.UTF-8 LC_IDENTIFICATION=C
##
## attached base packages:
## [1] stats graphics Grdevices utils datasets methods base
##
## other attached packages:
## [1] cowplot_1.1.0 magrittr_1.5 forcats_0.5.0 stringr_1.4.0
## [5] dplyr_1.0.2 purrr_0.3.4 readr_1.3.1 tidyr_1.1.2
## [9] tibble_3.0.3 ggplot2_3.3.2 tidyverse_1.3.0 Matrix_1.2-18
##
## loaded via a namespace (and not attached):
## [1] tidyselect_1.1.0 xfun_0.18 haven_2.3.1 lattice_0.20-41
## [5] colorspace_1.4-1 vctrs_0.3.4 generics_0.0.2 htmltools_0.5.0
## [9] yaml_2.2.1 blob_1.2.1 rlang_0.4.7 pillar_1.4.6
## [13] withr_2.3.0 glue_1.4.2 DBI_1.1.0 dbplyr_1.4.4
## [17] modelr_0.1.8 readxl_1.3.1 lifecycle_0.2.0 munsell_0.5.0
## [21] gtable_0.3.0 cellranger_1.1.0 rvest_0.3.6 evaluate_0.14
## [25] knitr_1.30 fansi_0.4.1 broom_0.7.1 Rcpp_1.0.4.6
## [29] scales_1.1.1 backports_1.1.10 jsonlite_1.7.1 farver_2.0.3
## [33] fs_1.5.0 hms_0.5.3 digest_0.6.25 stringi_1.5.3
## [37] grid_4.0.2 cli_2.0.2 tools_4.0.2 Crayon_1.3.4
## [41] pkgconfig_2.0.3 ellipsis_0.3.1 xml2_1.3.2 reprex_0.3.0
## [45] lubridate_1.7.9 assertthat_0.2.1 rmarkdown_2.4 httr_1.4.2
## [49] rstudioapi_0.11 R6_2.4.1 compiler_4.0.2
解决方法
The GitHub issue,@ ManavalanGajapathy在评论中指出的内容与我的经历相同。总而言之,我开始使用的Miniconda3(基于Debian的)Docker容器不包含R可以在绘图中使用的字体。该主题讨论了在Docker级别(apt-get)和Conda级别安装字体的多个选项。
我最终选择的解决方案是将依赖项fonts-conda-ecosystem
添加到我的Conda环境中。现在的最终输出是: