在geom_bar图表中使用变量值作为阈值添加水平线

时间:2014-10-25 14:04:44

标签: r ggplot2

我正在使用以下代码来排序实验中不同参与者的相关性。由于Correlation介于-1和1之间,因此我还想在图中添加一条水平线,在上面和下面的0.7之间进行相关性划分。 (非异常值与异常值)

有什么好办法吗?

Correlation <-c(0.134, 0.789, 0.654, 0.987, 0.854, 0.933,0.664, -0.325,0.769, 0.546)
Participant<-c("A1", "A2", "A3","A4","A5","A6","A7","A8","A9","A10")
Outlier<-data.frame(Participant = Participant, Correlation= Correlation)
o <- order(Outlier$Correlation, decreasing = FALSE)
Outlier$Participant <- factor(Outlier$Participant, levels = Outlier$Participant[o])
Outlier_P <- ggplot(Outlier, aes(Participant, Correlation)) +
geom_bar(stat = "identity", fill = "White", colour= "Black")
Outlier_P

0 个答案:

没有答案
相关问题