R ggplot2覆盖直方图三列数据帧

时间:2018-08-22 12:00:42

标签: r ggplot2 histogram

我有以下数据框:

Triage    v       value
1       OverAll 0.008314562
2       OverAll 0.076387969
3       OverAll 0.593447728
4       OverAll 0.285013913
5       OverAll 0.036835829
1       DidNotWait  NA
2       DidNotWait  0.00252738
3       DidNotWait  0.48272957
4       DidNotWait  0.447346251
5       DidNotWait  0.067396799

通过使用R ggplot,我需要覆盖两个分布:一个用于“ OverAll”,另一个用于“未等待”。然后,x轴将根据“分类”进行绘制,而Y轴将具有该值。

我正在使用这个

ggplot(temp, aes(Triage, v)) + 
  geom_histogram(data = subset(temp, temp$v == 'OverAll'), fill = 'blue', alpha = 0.1, ) +  
  geom_histogram(data = subset(temp, temp$v == 'DidNotWait'), fill = 'blue', alpha = 0.1, ) 

但是它不起作用

0 个答案:

没有答案