[R] legend()

Jim Lemon bitwrit at ozemail.com.au
Sat May 1 14:20:12 CEST 1999


Jon,

It's fairly easy to get empty boxes and only some lines, e.g.

> legend(6,4,legend = c("al", "ben", "chris", "dave"),lty = c(1, 2, 3,
-1),
+ fill = c("white","white","white", "gray"))

If you really want to get box or line only, try replacing line 133 in
the function 'legend' with the following:

        for (boxcount in 1:length(xt)) {
            if (is.numeric(fill[boxcount]))
                dobox <- !is.na(fill[boxcount])
            if (is.character(fill[boxcount]))
                dobox <- nchar(fill[boxcount])
            if (dobox)
                rect2(xt[boxcount], yt[boxcount] + ybox/2, dx = xbox,
                  dy = ybox/2, col = fill[boxcount])
        }

Not very elegant, but it does the job.

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