[R] legend positioning problems

Schweitzer, Markus Markus.Schweitzer at hilti.com
Mon Nov 13 11:35:56 CET 2006


Hello,

I have several Barplots I want to plot. I also want to include a legend.
Since my Barplots are very different I ve dicided to put the legend in
the top left corner.

Unfortunately, sometimes there is a part of a bar just below the legend.

This makes it difficult to see the legend itself or the barplot.

All I found out so far, is to make the backgroundcolor of the legend
white or so, but I would couldn t see the bar anymore.

Is there a way, to position the legend "excel-like" on the outside the
plot on the side? or
Is there a possibility to use sort of an alpha-factor to make the
background white but slightly invisible so that there is a contrast?

I hope you can help me out and thank you in advance!

#Example:
barplot(VADeaths)
legend("topleft", c("1xxxxx", "2xxxxx", "3xxxxx", "4xxxxx", "5xxxxx"),
bg="white"))




Markus Schweitzer - http://www.pokertips.tk



More information about the R-help mailing list