[R] geom_errorbar() issue in ggplot2
Axel Urbiz
axel.urbiz at gmail.com
Thu Apr 23 12:06:36 CEST 2015
Hello,
I'm getting a warning message from the reproducible example below.
Why would geom_errorbar() remove 2 cases in this case? Both upper and lower
limits of the error bar contain var1 and are within the axis limits.
df <- data.frame(var1 = seq(0, 1, 0.1), var2 = seq(0, 1, 0.1))
df$ll <- ifelse(df$var1 == 0, 0, df$var1 - 0.05)
df$ul <- ifelse(df$var1 == 1, 1, df$var1 + 0.05)
pp1 <- ggplot(data = df,
aes(x = var2, y = var1)) +
geom_line() + geom_point() +
scale_x_continuous(limits = c(0, 1), breaks = seq(0, 1, 0.1)) +
scale_y_continuous(limits = c(0, 1), breaks = seq(0, 1, 0.1))
pp1
pp2 <- pp1 + geom_errorbar(data=df,
aes(ymin=ll,ymax=ul), width=0.02)
pp2
Warning message:
In loop_apply(n, do.ply) :
Removed 2 rows containing missing values (geom_path).
>
Thanks for any pointers.
Best,
Axel.
[[alternative HTML version deleted]]
More information about the R-help
mailing list