Unit of legend() coordinates (was: Re: [R] lines and legend)

Paul Lemmens P.Lemmens at nici.kun.nl
Wed Jul 2 08:47:42 CEST 2003

Dear all,

I would like to make a suggestion for an improvement (IMHO) of ?legend.

Please add a remark that the x,y positioning coordinates are in the units 
of the plot() itself, *not* in pixels or anything the like.

It would have saved me a lot of time figuring out why my legend just 
wouldn't appear if ?legend would have told me to set the coordinates in the 
units of the x and y axis. I haven't found it anywhere on the list or 
manuals (but I may have missed something). Now that I know this, it seems a 
logic choice, however, refering to a 'graphics device' seems to imply a 
coordinate system in pixels starting from the upper/lower left of the 
device (the usual choice in graphical manipulations in programming 
languages). This assumption is false and IMHO is nowhere in FAQ/manuals 


--On dinsdag 1 juli 2003 11:23 -0700 "Anna  H. Pryor" 
<anna at ptolemy.arc.nasa.gov> wrote:

> Yes, I am using plot and then lines.  The legend is just not appearing.
> I am  using the coordinates of the legend (150,4) which work on boxplot
> and plot.   I have not looked at the output of par (I don't know how to)
> to see if they  are in the region.  I assumed if they worked for plot and
> boxplot they would  also for lines.
> On Tuesday 01 July 2003 11:16, you wrote:
>> I assume that you are calling 'plot' and then 'lines'.  Is the legend
>> just not appearing?  what are you using for the coordinates of the
>> legend?  Have you looked at the output from "par" to see if these values
>> are within the plot region?
>> When I am trying to put a legend on a plot where I am using "lines", R
>> just
>> ignores it.  I can do it with boxplot or plot, but just not with lines.
>> Am I
>> doing something wrong?  Maybe I am just making a mistake?

Paul Lemmens
NICI, University of Nijmegen              ASCII Ribbon Campaign /"\
Montessorilaan 3 (B.01.03)                    Against HTML Mail \ /
NL-6525 HR Nijmegen                                              X
The Netherlands                                                 / \
Phonenumber    +31-24-3612648
Fax            +31-24-3616066

More information about the R-help mailing list