R绘图结果里的中文字体

library(ggplot2)
library(ggtree)
library(showtext)
## Add fonts that are available on Windows
## font_paths() ##check font path
font_add("lishu", "SIMLI.TTF")


nwk <- ("111.nwk")
tree <- read.tree(nwk,fileEncoding = 'UTF-8')
p <- ggtree(tree) + geom_tiplab(aes(subset=grepl("中国字", label)),family = "lishu") 

showtext_auto()

pdf("example2.pdf", 7, 4)
print(p)
dev.off()

你可能感兴趣的:(R绘图结果里的中文字体)