I'm trying to use the boxplot()
function in R to show the 10th and 95th percentiles, rather than the 1.5*IQR by default. People have provided solutions on this forum but none of them seem to work for me.
For all my initial few box plots I used ggplot2 which worked great. However, recently I discovered that stat_summary
plotted the mean in the wrong place for one of the sites I'm studying during summer.Image generated by ggplot2
I could only resolve this using Boxplot()
using the following;
boxplot(mydata$tgm~interaction(mydata$site, mydata$season),
las = 1,
names = c("BFa", "MBa", "STa", "BFsp", "MBsp", "STsp", "BFsu", "MBsu", "STsu", "BFw", "MBw", "STw"),
col = c("royalblue", "red", "green", "royalblue", "red", "green", "royalblue", "red", "green", "royalblue", "red", "green"),
outline = FALSE,
xlab = "Site per season",
ylab = "TGM concentration (ng/m3)")
And then:
means <- aggregate(mydata$tgm~interaction(mydata$site, mydata$season), data = mydata, mean)
points(means, col = "black", pch = 16)
Is there anyway for me to alter my argument so that the 10th and 90th percentiles are displayed?