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()
网友评论