As Stephen points out, there is not enough space to display all the x-axis values. So rotating the values on the x-axis would help.
You can easily do this using the par() function while making a box plot of yvalues~xvalues as follows:
par(las=2)
boxplot(yvalues~xvalues)
You may also want to reduce the text size of the xvalues. For this the easiest way is to save the boxplot to an object (e.g. bp) and suppress the printing of the xvalues. Then use the axis() function to specify the xvalues and reduce the font size (using cex.axis). Change the cex.axis values to find the text size that suits you.
You can delete the line darwing the "level 3" x-axis. The colors are set by specifying the argument col in boxplot as a vector of 16 times "orange" and 16 times "skyblue", created with
col = rep(c("oragnge","skyblue"), each=16)
The legend was added with the function legend(), like
I would love to create a similar boxplot but I am having problems in adjusting the R-code of Jochen to my data.
In my data set (ac.hu.green) have one numerical response variables (oral_disk) and 3 categorical (species, location and depth). Do you know perhaps what code I could use?
I tried doing a boxplot with this function :boxplot(oral_disk~species*location*depth, data=ac.hu.green, notch=TRUE,
col=(c("darkgreen","green")),
main="G-values of Oral disk HU_AC", xlab="Location and Depth")
But its very confusing and does not lable all the x values
Thank you very much for your help. Now i am getting all the values on the x axis (which is much better than before). Any chance you know how to put them in subgroups as you did in the very fist picture? In this way the lable would be a bit more clear, avoiding repetition of some values. It is also putting the picture to the very far right of the image.