为什么ggplot不显示boxplot的错误栏?

问题描述

我在R中用ggplot做一些箱形图,我想知道为什么它不只显示一个箱形图的误差线?

enter image description here

代码就是这个:

session->put('user.comments.likes',$likes)

我不知道这是与代码有关的问题,还是与数据有关的问题

ID1.4.5.6.7[,"Time"] <- as.factor(ID1.4.5.6.7[,"Time"])
ggplot(data=ID1.4.5.6.7,aes(x=Time,y=mRNA,fill=Time)) +
  geom_Boxplot(notch = TRUE) +
  
  stat_Boxplot(geom="errorbar")+
  
  labs(title="mRNA vs Time",subtitle="Irradiated",x = "Time [min]",y = "mRNA")+
  theme(plot.title = element_text(hjust = 0.5),plot.subtitle = element_text(hjust = 0.5))

这里是dput(ID1.4.5.6.7),所以是数据帧。

解决方法

我建议您使用此方法启用data () { return { title: '',subtitle: '',imageUrl: '',location: '',content: '',date: '',isPublic: false,author: '',image: null,footprint: [] } },methods: { createNode: function() { this.$store.dispatch('createMatter',{ title: this.title,subtitle: this.subtitle,content: this.content,date: this.date,isPublic: this.isPublic,author: this.author,location: this.location,imageUrl: this.imageUrl,image: this.image,footprint: this.footprint }) },以便查看错误栏。这里的代码:

varwidth

输出:

enter image description here

,

因为箱线图没有错误栏。箱线图只是五个数字的图形表示:最小值,Q1(第一四分位数),中位数,Q3(第三四分位数)和最大值。晶须(上下的“条”)只是以数据中的最小值(较低的值)和最大值(较高的值)结尾的行。 “盒子”的底边是Q1,顶边是Q3。

可以安排一组数据,使得最小值与Q1相同,最大值与Q3相同。或多或少,这似乎是没有晶须的箱线图中发生的情况。 ggplot在boxplot中添加了一些额外的细节(“腰”被拉入,并且进行了算法调整,导致您可能在Time 0组的顶部看到了反转),但似乎或多或少是正在发生的事情。

编辑:这似乎是关于代码的问题,但实际上是关于统计信息的问题。交叉验证可能会更好(尽管我认为现在可能已经足够回答了。)