[字体问题已解决,但现在的问题是字母不在SBT的栏上。它给了我两次SBT,在图中突出显示]
我正在使用ggplot
作为条形图并收到此错误。
In grid.Call.graphics(L_text, as.graphicsAnnot(x$label), x$x, x$y, :
font family not found in Windows font database
我尝试安装extrafont
,但仍然遇到此错误。
我正在使用R.version 3.4.2
以下是我的代码:
library(ggplot2)
plot2 <- ggplot(Test, aes(x=factor(Test$habitat3), y=proportion, fill=proportion)) +
geom_bar(stat="identity", position="stack", colour="black", fill="grey") +
geom_errorbar(aes(ymin=stdlow, ymax=stlup, width=0, position="identity")) +
xlab("Habitat") +
ylab("root abundance") +
coord_cartesian(ylim = c(0, 1)) +
scale_y_continuous(expand=c(0,0)) +
theme(axis.title.x=element_text(margin = unit(c(6, 0, 0, 0), "mm"))) +
theme(axis.title.y=element_text(margin = unit(c(0, 6, 0, 0), "mm"))) +
theme(axis.line.x = element_line(color="black"), axis.line.y = element_line(color="black")) +
theme(text = element_text(size=14, colour = "black")) +
theme(legend.position="none") +
theme(axis.text.y = element_text(size = 14, colour = "black")) +
theme(axis.text.x = element_text(size = 14, colour = "black")) +
theme(plot.background=element_blank(),
panel.grid.major=element_blank(),
panel.background=element_blank(),
panel.grid.minor=element_blank(),
legend.key=element_blank(),
legend.background=element_blank()) +
theme(text=element_text(family = "Arial")) +
annotate("text", x="PV", y=3.1, label="ab") +
annotate("text", x="WB", y=4.18, label="a") +
annotate("text", x="AF", y=2.98, label="b") +
annotate("text", x="EZ", y=3.43, label="ab")