Adding points to multiple boxplots

后端 未结 1 1214
终归单人心
终归单人心 2021-01-14 23:33

How would you add points to a several boxplots beside one another of varying lengths?

boxplot(box1, box2, box3, box4, beside=T, col=c(\"grey100\", \"grey70\"         


        
相关标签:
1条回答
  • 2021-01-15 00:04

    Try:

    ndata=mtcars[mtcars$carb%in%c(1:4),]
    boxplot(mpg ~ carb, data=ndata 
            , beside=T,
            col=c("grey100", "grey70", "grey50", "grey70"),
            names=c("box1", "box2", "box3", "box4"),
            main="all the boxes", las=2)
    
    points(factor(ndata$carb), ndata$mpg,col=3)
    points(3,30,col=4,pch=13)
    text (3.5,30,"Oops",pos = 4)
    

    0 讨论(0)
提交回复
热议问题