5
I would like to make two modifications to the following chart
Leave a small space between the green(F) and orange(s boxplot)
Place the point referring to the median at the center of each boxplot (the points are appearing at the end of the boxplot and when the two Plots have the same median value, only one point is plotted).
Does anyone know what changes I should make to my script?
My spreadsheet can be accessed by the link: https://drive.google.com/open?id=1X-gmhUmUqcIJmFtpHwaBO6fclJIUK4Sc
Already appreciate any help, below I leave the sampling:
library(ggplot2)
head(dados)
dados$warfare <- factor(dados$warfare, levels=c("war1", "war2", "Post"))
ggplot(dados, aes(x=warfare, y=Abund, group=warfare:habitat_F_S, colour = as.factor(habitat_F_S), fill=habitat_F_S)) +
geom_boxplot(outlier.shape = NA) +
scale_fill_brewer(palette="Dark2") +
scale_colour_brewer(palette="Dark2") +
stat_summary(fun.y=median, geom="line", lwd=1, aes(group=habitat_F_S, colour=habitat_F_S)) +
stat_summary(fun.y=median, colour="black", geom="point", shape=18, size=1,show_guide = FALSE, aes(group=habitat_F_S, colour=habitat_F_S)) +
facet_wrap(~ specie, nrow=5) +
labs(x="time", y="Abund", colour="Habitat", fill="Habitat") +
theme(axis.text.x = element_text(angle = 45, hjust = 1))
Hello Alexandre, thanks for the comment. But I could not do what I wanted with your command. I don’t know if my text was clear, but I just wanted to simply add a small space between each orange and green Plot that are attached.
– Fran Braga
Fran, I get it, I altered the answer to meet the need you mentioned.
– Alexandre Cavaloti
now it worked, thank you! I assessed your response as positive, but someone had assessed it as negative before..
– Fran Braga