[R] position of a legend-object

Duncan Murdoch murdoch at stats.uwo.ca
Thu Jun 9 20:25:57 CEST 2005


On 6/9/2005 1:05 PM, Carsten Steinhoff wrote:
> Hello,
>  
> I've written a function that plots a few functions in a diagram.
> The xlim and or ylim is not always the same, and set automatically by R.
> A legend is part of this object.
> Now the problem is: where to put the legend? Me would help a function that
> returns the limits and scaling of the axis.

Besides the suggestions other have sent, you might find something like

legend("topright", ...)

(which puts it at the top right of the plot) does what you want.

This keyword positioning was new in 2.1.0.

Duncan Murdoch




More information about the R-help mailing list