Im not able to figure it out why the lower quartile of the two data points missing.



df <- read.csv("NC_II_box_plot_input.txt",sep = ",")

df_melt = melt(df,id.vars = NULL)

df_melt$Group <- gsub("HSC",'',df_melt$variable)
df_melt$Group <- gsub("CMP",'',df_melt$Group)
df_melt$Group <- gsub("GMP",'', df_melt$Group)
df_melt$Group <- gsub("Mono",'', df_melt$Group)
df_melt$Group <- factor(df_melt$Group,levels = c("m","nc","r","rr","sn","t"))

ggplot(df_melt, aes(variable,value)) +
  stat_boxplot(geom="errorbar", width=.5)+
  geom_boxplot(aes(fill=Group), position = position_dodge2(preserve = "total"))+
  scale_fill_manual(values=c("grey","dodgerblue4","red","darkgreen","brown","maroon1")) + #for boxplot
  # scale_fill_manual(values=c("grey","dodgerblue4","red","darkgreen","brown")) + #for boxplot
  geom_jitter(position=position_jitter(width=0.3), size=0.01, colour="black") +

  #scale_fill_manual(values = c("black","brown","maroon1","darkgreen"))+
  #stat_summary(fun.y=mean, colour="red", geom="line", aes(group = 1))+
  #geom_jitter(position = position_jitter(0.0001),size=.00001)+

  theme(axis.text.x=element_text(angle = 45, size=25, face="bold", hjust = 1), 
        axis.text.y=element_text(angle=0, size=35, face="bold", vjust=0.5),
        plot.title = element_text(size=40, face="bold"), 
        legend.key.size=unit(1, "cm"),      #Sets overall area/size of the legend
        legend.text=element_text(size=30)) +

  labs(x="Cell_Type", y=expression(paste("Expression"), title="Expression")) + 
  guides(colour = guide_legend(override.aes = list(size=5)))

rrCMP and rrMono lower quartile missing


to find the quartile i used this as well

A <- boxplot(df)
mytable <- A$stats
rownames(mytable)<-c('min','lower quartile','median','upper quartile','max')

Any help or suggestion would be highly appreciated

  • 1
    $\begingroup$ Could you clarify what is the quartile you can't find? (making the example more minimal) Do you mean that you want it to be plotted and it isn't or something else? $\endgroup$ – llrs Mar 20 '19 at 10:11
  • $\begingroup$ if you can look then the rrCMP lower quartile is missing is it because the data is as such or due to some code error that im not sure..about .. $\endgroup$ – krushnach Chandra Mar 20 '19 at 10:13
  • 1
    $\begingroup$ That is not the quantile but the 1.5*inter-quartile-range. Could you just provide the data for these category? Besides this question is purely about plotting/statistics not about bioinformatics (an expert on ggplot2 would be in much better position to answer if it is a bug on its side) $\endgroup$ – llrs Mar 20 '19 at 10:16
  • $\begingroup$ sorry yes the IQR my bad .Yes I have given the data file in the start of my question... $\endgroup$ – krushnach Chandra Mar 20 '19 at 10:19
  • $\begingroup$ Well, to my taste this is too much data, your problem doesn't need all the data you provided. It will help to focus the question... $\endgroup$ – llrs Mar 20 '19 at 10:21

Browse other questions tagged or ask your own question.