stephen@inf.ed.ac.uk
2003-Nov-26 13:25 UTC
[Rd] wishlist item: symbols() to accept asp argument? (PR#5328)
Here is a potential wishlist item for adding an argument (asp) to symbols(). The following code produces a postscript file with two pages; both should show a circle of radius 2 units. Horizonal and vertical arrows are drawn to check that the circle is of the correct radius; in the first plot, the circle is wrong. To fix this, I found that I needed to first set up the plot bounds, using xlim, ylim and setting asp=1 so that the units are of the same size. (Below uses the postscript driver, but I get similar results using x11() device.) postscript(file="circles.ps") symbols(x=6, y=6, circles=2, inches=F) arrows( 6, 6, 8, 6) #horiz radius, OK arrows( 6, 6, 6, 8) #vert radius, not OK. ## better version, but must set up axes first, and guess ylim plot(NA, xlim=c(1,10), ylim=c(4,10), asp=1) symbols(x=6, y=6, circles=2, inches=F, xlim=c(1,10), add=T) arrows( 6, 6, 8, 6) #horiz radius, OK arrows( 6, 6, 6, 8) #vert radius, OK. dev.off() My suggestion is whether asp can be set within symbols(), such that symbols(x=6, y=6, circles=2, inches=F, asp=1) would then ensure that the circle is drawn correctly. Thanks, Stephen> version_ platform i686-pc-linux-gnu arch i686 os linux-gnu system i686, linux-gnu status major 1 minor 8.1 year 2003 month 11 day 21 language R
Prof Brian Ripley
2003-Nov-26 18:29 UTC
[Rd] wishlist item: symbols() to accept asp argument? (PR#5328)
It's rather your peculiar example. If you give more than one circle, asp=1 is accepted and does work (with warnings). Symbols is not designed for one symbol (as its name says), and the way it sets up xlim and ylim in the R code asp=1 does not work for a single symbol. In the same way plot(10, asp=1) does not work (and for the same reason). That's not to say that it could not be fixed, but the issue is not that asp does not work with symbols() but rather that plot(10, asp=1) does not work. Arrows is designed to work with vector too .... On Wed, 26 Nov 2003 stephen@inf.ed.ac.uk wrote:> Here is a potential wishlist item for adding an argument (asp) to > symbols(). The following code produces a postscript file with two > pages; both should show a circle of radius 2 units. Horizonal and > vertical arrows are drawn to check that the circle is of the correct > radius; in the first plot, the circle is wrong. To fix this, I found > that I needed to first set up the plot bounds, using xlim, ylim and > setting asp=1 so that the units are of the same size. (Below uses the > postscript driver, but I get similar results using x11() device.) > > postscript(file="circles.ps") > symbols(x=6, y=6, circles=2, inches=F) > arrows( 6, 6, 8, 6) #horiz radius, OK > arrows( 6, 6, 6, 8) #vert radius, not OK. > > ## better version, but must set up axes first, and guess ylim > plot(NA, xlim=c(1,10), ylim=c(4,10), asp=1) > symbols(x=6, y=6, circles=2, inches=F, xlim=c(1,10), add=T) > arrows( 6, 6, 8, 6) #horiz radius, OK > arrows( 6, 6, 6, 8) #vert radius, OK. > dev.off() > > My suggestion is whether asp can be set within symbols(), such that > > symbols(x=6, y=6, circles=2, inches=F, asp=1) > > would then ensure that the circle is drawn correctly.-- Brian D. Ripley, ripley@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