Dear all,
I use the qiime2r to make a barplot,but I foun the value the bar displayed is wrong. The mean of PLA CK should be 4.06, but it is about 5.5 in bar plot.
My codes are here
metadata<-
metadata %>%
left_join(shannon)
head(metadata)
levels (metadata$"Fertilizer-type")= c("CK", "CF", "OF")
filter_data<- metadata %>%
filter(Source =="Plastic")
filter_data$Plastic-type
<- factor(fd$Plastic-type
, levels = c('LDPE', 'PLA', 'PBS', 'PBAT'))
p1 <- filter_data %>%
filter(!is.na(shannon)) %>%
ggplot(aes(x=Fertilizer-type
, y=shannon, fill=Fertilizer-type
)) +
stat_summary(geom="bar", fun.data=mean_se, color="black") + #here black is the outline for the bars
stat_summary(geom="errorbar", fun.data=mean_se,colour="black", width=0.1,size=1) +
coord_cartesian(ylim=c(2,7.5)) +
facet_grid(~Plastic-type
) +
xlab("Fertilizer Usage") +
ylab("Shannon Diversity") +
theme_q2r() + # try other themes like theme_bw() or theme_classic()
scale_fill_manual(values=c("#FF5A5F","#FFB400", "#007A87")) + #specify custom colors
theme(legend.position="none") #remove the legend as it isn't needed
p1
head(p1)