gpt4 book ai didi

r - 向多个箱线图添加点

转载 作者:行者123 更新时间:2023-12-05 01:46:58 26 4
gpt4 key购买 nike

如何将点添加到多个相邻的不同长度的箱线图中?

boxplot(box1, box2, box3, box4, beside=T, col=c("grey100", "grey70", "grey50", "grey70"), names=c("box1", "box2", "box3", "box4"), main="all the boxes", las=2)

如果我放入一些东西

points() 

功能 我不能添加多个,如果我将它们分开放置,它们将被添加到所有箱线图中,我只想查看相应的点。

最佳答案

尝试:

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)

enter image description here

关于r - 向多个箱线图添加点,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33153951/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com