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

<p><a href="https://drive.google.com/open?id=1DsUAkSCyMWRYWtShuT0gZ_6Cn0bi1toL" rel="nofollow noreferrer">Data</a></p>

<p>Code </p>

<pre><code>require(reshape2)
require(ggplot2)
require(RColorBrewer)
#require(dplyr)
require(tidyr)
require(tibble)
df &lt;- read.csv("NC_II_box_plot_input.txt",sep = ",")

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

df_melt<span class="math-container">$Group &lt;- gsub("HSC",'',df_melt$</span>variable)
head(df_melt)
df_melt<span class="math-container">$Group &lt;- gsub("CMP",'',df_melt$</span>Group)
df_melt<span class="math-container">$Group &lt;- gsub("GMP",'', df_melt$</span>Group)
df_melt<span class="math-container">$Group &lt;- gsub("Mono",'', df_melt$</span>Group)
df_melt<span class="math-container">$Group &lt;- factor(df_melt$</span>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_bw(base_size=15)+
  theme_bw()+

  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.title=element_blank(), 
        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)))
</code></pre>

<p><a href="https://i.sstatic.net/Y2NNy.jpg" rel="nofollow noreferrer"><img src="https://i.sstatic.net/Y2NNy.jpg" alt="rrCMP and rrMono lower quartile missing "></a></p>

#

<p>to find the quartile i used this as well </p>

<pre><code>A &lt;- boxplot(df)
mytable &lt;- A<span class="math-container">$stats
colnames(mytable)&lt;-A$</span>names
rownames(mytable)&lt;-c('min','lower quartile','median','upper quartile','max')
mytable 
</code></pre>

<p>Any help or suggestion would be highly appreciated </p>

CC BY-SA 4.0
2019-03-20T10:11:21.510Z
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?
llrs
CC BY-SA 4.0
2019-03-20T10:13:20.813Z
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 ..
kcm
CC BY-SA 4.0
2019-03-20T10:16:48.140Z
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)
llrs
CC BY-SA 4.0
2019-03-20T10:19:06.557Z
sorry yes the IQR my bad .Yes I have given the data file in the start of my question...
kcm
CC BY-SA 4.0
2019-03-20T10:21:43.303Z
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...
llrs
<r><ggplot2>
Missing lower IQR in boxplot
# Missing lower IQR in boxplot

(Asked by: username_0 on 2019-03-20)

Im not able to figure it out why the lower quartile of the two data points missing.
Data
Code 
require(reshape2)
require(ggplot2)
require(RColorBrewer)
#require(dplyr)
require(tidyr)
require(tibble)
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)
head(df_melt)
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_bw(base_size=15)+
  theme_bw()+

  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.title=element_blank(), 
        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)))



#

to find the quartile i used this as well 
A <- boxplot(df)
mytable <- A$stats
colnames(mytable)<-A$names
rownames(mytable)<-c('min','lower quartile','median','upper quartile','max')
mytable 

Any help or suggestion would be highly appreciated

**Tags:** r, ggplot2
> **Comments:**
> **username_1**: 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?  
> **username_0**: 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 ..  
> **username_1**: 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)  
> **username_0**: sorry yes the IQR my bad .Yes I have given the data file in the start of my question...  
> **username_1**: 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...  

---

## 0 answers

