【发布时间】:2020-11-10 22:55:05
【问题描述】:
我在一个直方图上绘制两个变量的分布。我有兴趣通过虚线或类似的东西突出显示该图上每个分布的平均值(但希望与代码的 aes 部分中已经存在的颜色相匹配)。
我该怎么做?
这是我目前的代码。
hist_plot <- ggplot(data, aes(x= value, fill= type, color = type)) +
geom_histogram(position="identity", alpha=0.2) +
labs( x = "Value", y = "Count", fill = "Type", title = "Title") +
guides(color = FALSE)
另外,有没有办法在这张图上显示每种类型的 n 计数?
【问题讨论】: