Unit of legend() coordinates (was: Re: [R] lines and legend)
Prof Brian Ripley
ripley at stats.ox.ac.uk
Wed Jul 2 09:17:30 CEST 2003
On Wed, 2 Jul 2003, Paul Lemmens wrote:
> 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.
That's true of all x-y coordinates of all R plotting functions. We don't
say it in ?points, for example.
> 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
There are several examples on the help page for legend which contradict
that assumption, so I don't see how you can have maintained it after
reading them, let alone after trying them out.
The coordinate systems are explained in detail in `An Introduction to R':
The phrase `graphics device' does not appear on the help page for legend,
so you must have found that somewhere else.
Is it reasonable to expect the help system/manuals to contradict all
possible misconceptions of all users? If we attempted to do that, the
help pages would get impossibly cluttered by even those misconceptions
which come to light.
Brian D. Ripley, ripley at stats.ox.ac.uk
Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel: +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UK Fax: +44 1865 272595
More information about the R-help