我正在尝试将面板标签添加到图中的不同方面。我希望它们是 1:7,但是,下面的代码
d <- ggplot(diamonds, aes(carat, price, fill = ..density..)) +
xlim(0, 2) + stat_binhex(na.rm = TRUE) + opts(aspect.ratio = 1)
d1<-d + facet_wrap(~ color)
d1+annotate("text", x=0.25, y=1.5e+04, label=1:7)
产量
Error: When _setting_ aesthetics, they may only take one value. Problems: label
现在,我可以提供一个值并将其复制到所有方面。但是如何使用 annotate() 在不同的方面拥有不同的标签?