[Rd] symbols() draws squares too high (PR#9027)
Prof Brian Ripley
ripley at stats.ox.ac.uk
Fri Jun 23 16:13:01 CEST 2006
On Fri, 23 Jun 2006, Duncan Murdoch wrote:
> On 6/23/2006 9:55 AM, michellang at gmail.com wrote:
>> Full_Name: Michel Lang
>> Version: 2.2.1
That's long obselete, and quite possibly the documentation was wrong then
(it was at some point in the midterm past).
>> OS: 2.6.16-gentoo-r9 on x86_64
>> Submission from: (NULL) (62.143.164.39)
>>
>>
>> plot(-2:2, -2:2, type = "n")
>> symbols(x = 0, y = 0, squares = 2, inches = FALSE, add = TRUE)
>>
>> This should plot a square with its center at (0,0) and side length 2, in other
>> words a square from (-1,-1) as lower left angle to (1,1) as upper right angle.
>>
>> However, if you execute this line
>> abline(h = c(-1,1))
>> you see that the squares height is definitely too large.
>
> This is not a bug.
>
> The documentation says that when inches = FALSE, the units are those of
> the x axis, so horizontal lines are not relevant. Try
>
> abline(v=c(-1, 1))
>
> If you want your x and y scales to be identical, I think you need to use
> grid and lattice, rather than traditional graphics, and to set aspect="iso".
par(asp=1) or eqscplot (MASS) does this perfectly well in base graphics.
--
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-devel
mailing list