用R中的公式将点添加到箱线图中

时间:2019-07-27 18:35:36

标签: r scatter-plot boxplot

我很确定必须先问这个问题,但是我花了很多时间进行搜索,但没有发现这个确切的问题。

我想制作一个箱线图并为其添加点。我尝试过

from re import sub

while True:
    if "-+" not in string and "+-" not in string and "++" not in string and "--" not in string:
        break
    string = sub("\++", "+", string).replace("--", "+").replace("+-", "-").replace("-+", "-")

未添加任何要点(但未产生任何错误,警告或注释或任何内容)。

然后我尝试了

library(MASS)
attach(Cars93)


Cars93Mod <- subset(Cars93, Passengers < 7 & Passengers > 3)
detach(Cars93)
attach(Cars93Mod)

boxplot(Price~Passengers, yaxt = 'n')
axis(2, las = 2)
points(x = Passengers, y = Price)

出现点但删除了箱线图的地方(尽管add = TRUE)。

如何将点添加到箱线图中?

0 个答案:

没有答案