2022-09-13-【迁移】R解决导出PDF时的字体问题.md 661 B


title: 【迁移】R解决导出PDF时的字体问题 urlname: R-jie-jue-dao-chu-PDF-shi-de-zi-ti-wen-ti date: 2022-09-13 20:22:48 index_img: https://api.limour.top/randomImg?d=2022-09-13 20:22:48

tags: ['R', 'fonts']

安装包

  • conda activate clusterprofiler
  • conda install -c conda-forge r-sysfonts -y
  • conda install -c conda-forge r-showtext -y

绘图

sysfonts::font_add("Arial Narrow", "~/font/Arial Narrow.ttf") # 添加字体
sysfonts::font_families() # 检查是否添加成功
{pdf(file = 'B_bnCov.plot.pdf', width = 12, height = 12)
 showtext::showtext_begin()
 print(bnCov$plot)
 showtext::showtext_end()
dev.off()}