Skip to content
Prev 2502 / 398506 Next

legend()

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

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

Martin
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
Message-ID: <199904301614.SAA04021@sophie.ethz.ch>
In-Reply-To: <Pine.GSO.3.96.990430154902.20515C-100000@laplace> (message from Jonathan Rougier on Fri, 30 Apr 1999 15:56:32 +0100 (BST))