[R] Legend problems

Jim Lemon bitwrit at ozemail.com.au
Thu May 24 13:52:36 CEST 2001


Ross Darnell wrote:

> I have not been able to solve a problem trying to put a legend onto an

image....

If I read your question correctly, you could have one or more of the
following problems

1) Your plot doesn't have enough blank space to fit the legend.
   Use xlim= and ylim= to expand the plot enough to fit the legend
inside, then eyeball the legend into place by passing x and y values to
legend() in user units instead of using locator=.

2) You don't want the legend in the plot and don't have enough space
outside the plot for it.
  Use par() to set a wider margin, xpd() to _allow_ you to put the
legend outside and pass x and y values to legend().

3) You want a really compact legend
  You _can_ fool around with the legend() function, but it's probably
easier to simply squeeze in filled rectangles and use text() to jam in a
legend.  You will have to fiddle with the positioning to get it to look
good.

Jim

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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