I have two categorical factors ('Habitat' and 'Locality'), and one continuous variable (T). 'Habitat' has two level and 'Locality' has eight levels. I want to change the default whiskers to represent the SE, and the median into the mean for each boxplot. Is there a way to do this and taking both of the categorical factors into account when plotting? Many thanks in advance.
This is what I have done with the default setting of boxplot ggplot, showing the first and third quartiles with median intervals.
ggplot(data,aes(x=Locality,y=T)) +
geom_boxplot(aes(fill=interaction(Habitat,Locality),
group=interaction(factor(Habitat),Locality)),
outlier.shape=1,outlier.size=3) +
theme_bw() +
theme(
panel.grid.major=element_blank(),
panel.grid.minor=element_blank(),
axis.line=element_line(colour='black'),
legend.position='none',
axis.text.x=element_text(angle=90,hjust=1,size=12)) +
scale_y_continuous('T') +
xlab('Locality')