I am using below code to plot multiple box plot but I am still struggling to understand how I can add whisker to box plot and how to change sample order like in this figure SampleType?
library(reshape2) library(ggplot2) list.files() morphData <- read.table("Box.plot.chemical.txt", sep="\t", header=TRUE) morphData df.m <- melt(morphData, id.var = "SampleType") pdf("box.plot.pdf", width = 18, height = 12) p <- ggplot(data = df.m, aes(x="", y=value)) + theme_bw() + theme( panel.grid.major=element_blank(), panel.grid.minor=element_blank(), plot.title = element_text(vjust = -8.5,hjust = 0.1), line=element_line(size=1), axis.text.x = element_text(size = 10, face ="bold", hjust = 0.5, colour = "black"), axis.text.y = element_text(size = 12, face ="bold", hjust = 0.5, colour = "black"), axis.ticks.x = element_blank()) + theme(strip.background=element_rect(fill="white")) + theme(strip.text=element_text(color="black",face="bold", size =14)) + geom_boxplot(aes(fill=SampleType),outlier.colour = NA) p + facet_wrap(.~variable, scales="free") dev.off();
I was able to remove the variable name from the bottom by using above updated code but still getting tick mark on x-axis, and also how I can make these label bold?
It will be a great help if you could also guide me how I can add Tukey's posthoc significance letter in above box plot to make this plot more meaningful. I was able to make bold facet wrap text, now please help me with posthoc test letter. I have updated the code again.
Can you please help to change the order of samples; like I want to change the order of SampleType in this box plot and also how we can remove outlier and will it be possible to add whisker so it will look better. I was able to remove outlier by using outlier.colour = NA, Now It just whisker, but I am not able to understand How I can add whisker to box plot? I have updated the code and figure above.
sorry, I wanted to add errorbar and with this command, it is not adding error bar on all box: