[R] geom_errorbar() issue in ggplot2
Axel Urbiz
axel.urbiz at gmail.com
Thu Apr 23 12:23:22 CEST 2015
Thanks Thierry. So if a variable x = a, and the limits for x are [a, a+b],
is that data point considered outside the limits?
Thanks,
Axel.
On Thu, Apr 23, 2015 at 6:17 AM, Thierry Onkelinx <thierry.onkelinx at inbo.be>
wrote:
> The limits are more narrow than the data. ggplot2 treats data outside the
> limits as NA.
>
> ir. Thierry Onkelinx
> Instituut voor natuur- en bosonderzoek / Research Institute for Nature and
> Forest
> team Biometrie & Kwaliteitszorg / team Biometrics & Quality Assurance
> Kliniekstraat 25
> 1070 Anderlecht
> Belgium
>
> To call in the statistician after the experiment is done may be no more
> than asking him to perform a post-mortem examination: he may be able to say
> what the experiment died of. ~ Sir Ronald Aylmer Fisher
> The plural of anecdote is not data. ~ Roger Brinner
> The combination of some data and an aching desire for an answer does not
> ensure that a reasonable answer can be extracted from a given body of data.
> ~ John Tukey
>
> 2015-04-23 12:06 GMT+02:00 Axel Urbiz <axel.urbiz at gmail.com>:
>
>> 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]]
>>
>> ______________________________________________
>> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide
>> http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>>
>
>
[[alternative HTML version deleted]]
More information about the R-help
mailing list