Mathias
Mathias

Reputation: 648

R: Boxplot - how to move the x-axis label down?

#RGR ~ Treatment:Geno boxplot
fit <- aov(Total.RGR~Treatment:Geno, data=For.R)
summary(fit)
t <- TukeyHSD(fit)
t
boxplot(Total.RGR~Treatment:Geno, 
data=For.R,las=2,ylim=c(-20,100),xlab="Treatment:Geno",ylab="RGR (mg/day)")
text(1:8, 95 ,c("a","ac","a","a","a","bd","bcd","ad"))

Is my code, it does the job, but when I rotate my x-axis labels the obstruct the x-axis title. Does any of you know of a way to move the title down?

Image

It must be easy but I cant find anything in the reference.

Thanks. Mathias

Upvotes: 3

Views: 20639

Answers (1)

agstudy
agstudy

Reputation: 121568

I would set xlab="" and add it afterwards using mtext. So, either you play with line parameter an put it the bottom under your lables Or change completely the side to put it in the top of the plot.

   mtext("Treatment:Geno", side=1, line=5)
   mtext("Treatment:Geno", side=3)

Upvotes: 6

Related Questions