Lets say I have a dataset about carrot yield from different fields and different breeds:
carrots<-list(Yield=c(345,226,74,559,288,194),
Field=c("A","B","C","D","E","F"),
Breed=rep(c("Long","Short"),each=3))
carrots<-data.frame(carrots)
I want to plot a bar plot showing the yield for each field, coloured by breed:
ggplot(carrots,aes(y=Yield,x=Field,fill=Breed)) +
geom_bar() +
opts(legend.direction = "horizontal",
legend.position = "top") +
labs(fill="")
But the legend is always slightly overlapping the plot area:

(source: users.utu.fi)
I’ve tried manually adjusting the legend position to be outside the plot area, such as with
opts(legend.position=c(0.5,1.1)
but then the plot margins cut off the legend and I’m not sure how I can adjust them. Is there a more subtle solution to this problem?
In my environment, the legend does not overlap the plot area at all, but anyway what is overlapping is the background of the legend, so you can remove it by: