Skip to content
Back to formatted view

Raw Message

Message-ID: <CAAyVsXJBpEhUFrTFTqEOOsh6t49U=GJhFhiS_GcxY2t=6r=ffA@mail.gmail.com>
Date: 2015-04-23T10:06:36Z
From: Axel Urbiz
Subject: geom_errorbar() issue in ggplot2

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]]