我绘制了一个直方图,显示了直方图 当分配不平衡的概率总和为 50%、80% 和 90% 时,我想添加垂直线。
我已经构建了直方图,但无法添加上述垂直线。
pl <- ggplot() +
geom_line(data = data.frame(power1, abs(t-c)), aes(x = abs(t-c), y = power1, color = "power"), size = 1) +
scale_y_continuous(labels = percent_format(), sec.axis = sec_axis(~.*.3, labels = percent_format(), name = "Probability of allocation imbalance")) +
geom_point(data = data.frame(power1, abs(t-c)), aes(x = abs(t-c), y = power1)) +
geom_histogram(data = Simple_Rand_simulation, aes(x = Imbalance_all, y = ..density..*3), color = "blue",
binwidth = density(Simple_Rand_simulation$Imbalance_all)$bw) +
labs(y = "Probability of power", x = "Allocation imbalance", colour = "Parameter") +
theme(legend.position = c(0.8, 0.9))
pl
当分配不平衡的概率之和为 50%、80% 和 90% 时,我期望垂直线