0

相同的数据,使用两种不同的箱线图方法为晶须提供了两种不同的长度,我知道晶须只到达最大(最小)点,小于(大于)上(下)栅栏值。在我的情况下,他们选择了不同的最大值或栅栏计算错误。从我在文档中阅读的内容来看,这两种方法都使用 1.5 IRQ,并且围栏限制应该是 57.8,所以应该选择 39 而不是 58.8

http://docs.ggplot2.org/0.9.3.1/geom_boxplot.html

https://stat.ethz.ch/R-manual/R-devel/library/grDevices/html/boxplot.stats.html

geom_boxplot

geom_boxplot 与箱线图 箱形图

df=data.frame(num=c(81.16469 ,11.59219 ,29.7309 ,86.03547 ,16.42667 ,33.52099 ,26.07814 ,30.91522 ,39.49079 ,31.634 ,37.8732 ,20.50268 ,16.9127 ,20.1115 ,23.74309 ,22.30444 ,24.21399 ,27.30867 ,39.07071 ,14.81049 ,21.42116 ,23.30437 ,17.94871 ,17.50281 ,58.82008 ,20.18478 ,10.65572 ,37.97092 ,25.16336 ,35.69668))
quantile(df$num)
      0%      25%      50%      75%     100% 
10.65572 20.12982 24.68867 35.15276 86.03547 
boxplot(df$num)
IQR(df$num)*1.5+quantile(df$num)[4]
     75% 
57.68716 
ggplot(df,aes("x",num))+geom_boxplot()
boxplot(df$num)

更重要的是,我想使用任何函数从df$num统计数据(长度为 5 的向量,包含下胡须的极值、下“铰链”、中值、上“铰链”和上胡须的极值)中提取,所以我可以ggplot在特定位置添加文本。boxplot.stats(df$num)$stats下面提供了这些统计数据,但上面的胡须与我的结果不匹配ggplot

boxplot.stats(df$num)$stats
[1] 10.65572 20.11150 24.68867 35.69668 58.82008
4

0 回答 0