0

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.

Irith
  • 21
  • 2
  • Hi Irith. Remember we don't have your data and can't see your plot, and without these it's impossible to help you. Please edit your question to add `datR` by typing `dput(datR)` in the console and pasting the result into a code block. – Allan Cameron Dec 01 '20 at 13:04
  • Thank you for your comment. As you can see in my edited question, all variables are numeric but Cat - the category variable I made up, which contains labels of the different combinations of the two "X" variables – Irith Dec 01 '20 at 16:40
  • Hi Irith. You have added a little bit of information about your variables, but that still doesn't allow us to test or verify possible solutions. You haven't followed the advice that I gave in my initial comment about adding `datR` - and that's fine, but I just don't think you're going to get an answer to your question without either actual or dummy data. It's the kind of question that would be answered in a few minutes here if you included data, but will likely never be answered without it. Describing your data or showing a picture of data is not enough for us to work with I'm afraid. – Allan Cameron Dec 01 '20 at 16:49

0 Answers0