简体   繁体   中英

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

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( )

在此处输入图像描述

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( )

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM