Emily,

You need to set the xpd parameter to TRUE (using par) and use a negative
value for the inset argument in the legend command. For example to place a
legend on the right,

 legend("right",inset=c(-0.3,0),legend=somelegendvector)

See ?legend and play around with the values of inset to get an idea of how
it works.

On Sun, Aug 15, 2010 at 12:51 PM, Emily Forbes
<emily_forbes@hotmail.co.uk>wrote:

>
> Hi, please can you help me. When I add a legend to a boxplot it appears
> inside the plot area, how do you get it into the margins? I have already
> changed the parameters so there is space for it on the margin on the right
> hand side of the graph.
>
> Thanks, Emily
>
>        [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

	[[alternative HTML version deleted]]

