I am trying to create a boxplot chart with a doubled X-axis. Defining the x variable as an interaction of two variables produces a single box, and thus I defined a single categorical variable that contains all combinations. But then how can I define a doubled X-axis? annotate would require a location on the x-axis, which is categorical.
This is my original code:
g<- ggplot(datR, aes(Cat,mean.R.friend))
g + geom_boxplot(varwidth=T, fill="blue") +
theme(axis.text.x = element_text(angle=65, vjust=0.6)) +
labs(title="Boxplots of mean relatedness with contacts",
subtitle="N=100, 10 genes, Basic",
y="Mean contact relatedness",
x="")
All variables are numeric but Cat, which is a categorical variable containing labels of the different categories.