1

If a draw a circle like the following:

plot(0.5,0.5,axes=FALSE,ylim=c(0,1),xlim=c(0,1),asp=0)
axis(1,cex.axis=1.5)
axis(2,cex.axis=1.5)

library(plotrix)
draw.circle(0.5,0.5,0.5)

enter image description here

I would expect the circle to be perfectly bounded by 0 and 1 as I specify with the origin and radius in the draw.circle function.

Why does it extend my y-axis even though both axes are the same...is there a better package I can grab hold of or can I wrangle plotrix to do as i please.

Gavin Simpson
  • 170,508
  • 25
  • 396
  • 453
user1320502
  • 2,510
  • 5
  • 28
  • 46
  • Not an *exact* duplicate, but essentially the same (I think) as http://stackoverflow.com/questions/6322603/trying-to-draw-circles-based-on-distance-between-points , http://stackoverflow.com/questions/12619174/drawing-circles-in-r – Ben Bolker Nov 13 '12 at 18:06
  • 1
    More to the point, I think you might want to try setting `asp = 1`. – joran Nov 13 '12 at 18:10
  • 1
    @Joran `asp=0` is for a reason, please see.. http://stackoverflow.com/a/11309021/1320502 @Ben Bolker, I'll check those links, thank you very much – user1320502 Nov 13 '12 at 18:14
  • 1
    @user1320502 Well, the behavior you're seeing here is _directly_ related to `draw.circle`'s attempts to adjust for the aspect ratio of the plot. If you remove that correction, it seems to generate the out put you want (i.e. remove the `ymult` line in the source). – joran Nov 13 '12 at 18:16
  • as I said in comments to some of the previous questions, you have several things you need to get in sync: (1) the physical size of the plotting region, (2) the axis limits/ratio of x to y coordinates, (3) the aspect ratio. R functions don't generally have control of #1, so they try to play with #2 and #3 (see the code of `MASS::eqscplot` for example) – Ben Bolker Nov 13 '12 at 20:05

0 Answers0