R绘图结果里的中文字体

2019-06-21  本文已影响0人  孟德尔的小豌豆007
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()
上一篇下一篇

猜你喜欢

热点阅读