Why can't I produce the min and max value of the CI in ggplot?

Viewed 42

I want to draw a ggplot with geom_errorbar, normally min and max value of the CI is produced automatically, but I can't get it. See the the codes below and expected part of the graph which is showed in the red circle.

df14<-data.frame(size=c(1750,2000,2500,3000,1750,2000,2500,3000),
                 ratio=c(1.41,1.35,1.29,1.48,2.03,2.12,2.31,1.96),
                 IQ   =c( "M","M","M","M","F",
                          "F","F","F"))



ggplot(df14, aes(x= size, y=ratio, colour=IQ)) + 
  geom_errorbar(aes(ymin=ratio-0.05, ymax=ratio+0.05), colour="black", width=.1) +
  geom_line( ) +
  geom_point( )

enter image description here

1 Answers

Just leave the width out - or try it with a larger width. Or do you mean something else, when you say how can I make the errobar smaller?

library(ggplot2)

ggplot(df14, aes(x= size, y=ratio, colour=as.factor(IQ))) + 
  geom_errorbar(aes(ymin=ratio-0.05, ymax=ratio+0.05), 
                width = 50, colour="black") +
  geom_line( ) +
  geom_point( )

Related