[R] is there a way to create legends automatically?

Bill Simpson wsi at gcal.ac.uk
Wed Oct 25 09:51:27 CEST 2000


>   To "automatically" create a legend you can write a small function that
> plots your data and then generates a legend.  An example is below: the
> only slightly tricky thing is automatically generating the correct
> placement of the legend.  I've chosen here to put it in the upper
> left-hand corner.  It would be wonderful to be able to somehow know where
> to put it that it wouldn't overlap any of the data, but short of expanding
> the plot range beyond the range of the data I don't see that this is
> possible to do automatically.
How about automatically calling locator()? Then the user clicks on the
spot where the legend should appear. ?legend mentions that "a
call to the function `locator' can be used in place of the `x' and
`y' arguments".


Bill

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list