【发布时间】:2020-10-12 09:18:03
【问题描述】:
我正在使用以下代码,并且我希望每个条形都有一个标签来指示该条形的值,而不是如下所示的多个标签。有人可以帮忙吗?
ggplot(data = iris, aes(x = Species , y = Sepal.Length, fill = Species)) +
geom_bar(stat = "summary",
show.legend = T,
fun = mean) +
ylab("Sepal Length") + xlab("Types of Species") +
ggtitle('Sepal Length vs Species') +
scale_fill_manual("legend",
values = c(
"setosa" = "black",
"versicolor" = "orange",
"virginica" = "blue"
)) + geom_text(aes(label = Sepal.Length))
【问题讨论】: