Reputation: 11
My legend is overlapping my barplot - (stackoverflow will not let me post an image)
I have searched through a few similar questions but have not been able to resolve my problem. May I add that I am very new to R. I would be very grateful if anyone could help.
Here is my script
mids<-barplot(mean.growth,beside=T,legend=T, ylim=c(0,0.01), ylab="Growth (mm)")
arrows(mids,mean.growth-se.growth,mids,mean.growth+se.growth,length=0.1, code=3, angle=90)
text(mids,mean.growth+0.003,labels=c("bc","a","b","cd","bc","bcd","cd","d","cd","d","d","cd"))
Upvotes: 0
Views: 2763
Reputation: 10194
If you read ?barplot
, you'll see that you can supply a list of arguments to be passed on to 'legend()'. The obvious suggestions are to set the x parameter, as in:
barplot(mean.growth,
beside=T,
legend=T,
args.legend = list(x = 'topleft') # or 'top','bottom','left','right',etc.
ylim=c(0,0.01),
ylab="Growth (mm)")
or to expand the xlim
or ylim
parameters to make the room for the legend.
Upvotes: 1