1
我想在一个图中结合两个变量, 一个作为geom_pointrange [因为我需要最小和最大表示(置信区间2.5%和97.5%及其中值(50%)) ]结合两个变量ggplot:geom_pointrange和geom_point
其他变量是geom_point,其他结石的中位数由
我发现ggplot使这些陈述,但我还没有得到它在一起,通过:
#inputs
x <- seq(1:10)
n <- length(x)
yone <- 2 * runif(n)
ytwo <- runif(n)
ythree <- ytwo * 0.2
yfour <- ytwo * 2
df <- data.frame(x, yone, ytwo, ythree, yfour); df
library (ggplot2)
#yone and ytwo must be points
#ythree and yfour are min and max confidence interval (vertical line)
ggplot(df, aes(x, y = value, color = variable)) +
geom_pointrange(aes(ymin = ythree, ymax = yfour)) +
geom_point(aes(y = yone, col = "yone")) +
geom_point(aes(y = ytwo, col = "ytwo")) +
geom_line(aes(y = yfour))
谁能帮我请问
应该采取什么结果是什么样子?你能把我们指向一个类似的图形吗?此外,现在您的示例不会运行,因为您提供的数据集不包含“值”或“变量”。 – aosmith