[R] Legend problems

Ross Darnell R.E.Darnell at ncl.ac.uk
Thu May 24 12:00:20 CEST 2001


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

After generating the image I try to add a legend with

legend(locator(1),c("0","0.2","0.4","0.6","0.8","1"),horiz=T,
        fill=c("white",rev(heat.colors(5))))

If I place the legend on top of the image the text and fill boxes are
shown, but unfortunately over the top of the image.

If I try to locate the legend somewhere else, in the top margin for
instance, the text (the legend) is displayed but not the fill boxes.

If I include the par option xpd, say

par(xpd=NA)

nothing changes. I thought this would stop this would allow the legend
to be printed inside the device but it doesn't seem to matter what xpd
value I use, the fill boxes do not appear anywhere except over the
image.

There must be another option that controls this. Can anyone help?

Regards
Ross Darnell


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