Barplot: error Warning message: Removed rows containing missing values (geom_bar).
0
0
Entering edit mode
3.8 years ago
Claire • 0

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 • 2.6k views
ADD COMMENT
0
Entering edit mode

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

ADD REPLY
0
Entering edit mode

@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 .

ADD REPLY

Login before adding your answer.

Traffic: 1414 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6