[R] legend()

Martin Maechler maechler at stat.math.ethz.ch
Fri Apr 30 18:14:54 CEST 1999

>>>>> "JonR" == Jonathan Rougier <J.C.Rougier at durham.ac.uk> writes:

    JonR> In legend() is it possibly to mix lines and boxes?  I would like
    JonR> to do something like

    JonR>   legend(locator(1), legend = c("al", "ben", "chris", "dave"),
    JonR> lty = c(1, 2, 3, NA), fill = c(NA, NA, NA, "gray"))

    JonR> to indicate that "al", "ben" and "chris" have lines, and "dave"
    JonR> has a gray shading.

Not quite, currently.

1) the fill colors currently must be integer (indexing into palette()).

2) Currently, either you get no or all boxes, <<--- to be improved by volunteer!
   since the 'fill' argument is only treated as scalar.
   Whereas this is easy to extend,
   much nicer (and more tedious) would be to NOT use "space" for a non-box
   and to NOT use space when there's no line

   (you probably understand what I mean, when looking at the following example).

Something *like* the above is possible with, e.g.,

	  legend(1,1, legend = c("al", "ben", "chris", "dave"),
	         lty = c(1, 2, 3, -1), fill = c(NA, NA, NA, 3))

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