我boxplot对R中的函数存在严重问题.箱图错误标记了图中的中间线.即使平均值是7.2376,在箱线图上它显示在4左右,如下图所示(使用以下代码生成)
DATA <- c(0.59, 1.00, 1.00, 1.04, 1.22, 1.40, 1.72, 1.74, 1.98, 3.44,
3.48, 3.50, 3.53, 3.93, 4.00, 4.33, 4.72, 9.49, 10.80, 11.40,
12.04, 16.98, 20.43, 27.27, 29.91)
> boxplot(DATA)
> mean(DATA) = 7.2376
Run Code Online (Sandbox Code Playgroud)

这让我疯了.它只与这个数据集一起使用.其他数据集,箱形图标记平均值就好了.
任何见解都非常感谢.
谢谢.
jor*_*ran 11
我的评论真的应该是一个答案......
你的困惑与boxplot功能不同,就像盒子图一样.一箱线图一般只显示五个值:分钟,第一四分位数,中位数,第三个四分位数和最大值.(此外,大多数绘图算法会根据某些规则将"异常值"分开.)
因此,箱形图中的中间线对应于中位数,而不是平均值.
我必须为这个愚蠢的错误赎回自己。对于那些希望标记均值的人,您可以执行以下操作:
> DATA_mean <- data.frame(Group ="A", Measure = DATA) #Make a data.frame first
> attach(DATA_mean) #Attach the data
> boxplot( Measure ~ Group) #Draw your boxplot as above
> means <- by(Measure, Group, mean) #Calculate mean and assign
> points(1, means, pch = 21, cex =1.5, bg = "blue") #Label mean on boxplot
#The default center is 1 for the boxplots, if you have more than one, it would be 1:2:3...etc
Run Code Online (Sandbox Code Playgroud)

希望这可以帮助某人。这对我来说是一个令人尴尬的错误。是时候睡觉了。
谢谢大家马上纠正我。