This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Barplot: error Warning message: Removed rows containing missing values (geom_bar).

I am trying to do barplots. When i add this command to put bars in order

scale_x_discrete(limits=c("Nitrogen","Methane","Carbon","sulfate","Thiosulfate","nitrification","nitrate"))

some bars were empty. I had this error Warning message: Removed 18 rows containing missing values (geom_bar).

how can I fix it? Thank you

df_sumzd=group_by(df_long,pathway,Samples) %>% summarise(mean=mean(length),sd=sd(length))

p=ggplot(df_sumzd,aes(x=pathway,y=mean,fill=Samples))+
  geom_bar(stat="identity",position="dodge") +
  geom_errorbar(aes(ymin=mean-sd,ymax=mean+sd),width=0.25,
                size=1,position= position_dodge(0.9),alpha=0.3)+
  theme(axis.text.x = element_text(angle = 45, hjust = 1))+
  scale_x_discrete(limits=c("Nitrogen","Methane","Carbon","sulfate","Thiosulfate","nitrification","nitrate"))
p
r

Try increasing the y limit with + ylim(lower, upper).

@rpolicastro i have the same error, i dont have the plots for nitrogen and sulfate. if I remove the order it is ok , but with ordering no .

0 answers

No answers yet.

Log in to answer this question.