If you want to convert between different units using base graphics then look at the grconvertX and grconvertY functions (in the graphics package). These functions will convert from/to user coordinates, inches, device, figure, and plot coordinates. So you could use grconvertX to find out what user value on the x scale to give to draw.circle that would then generate a circle with a given size in inches, or relative to the device, figure, or plotting region.
On Sun, Jan 20, 2013 at 2:59 PM, Murat Tasan <mmu...@gmail.com> wrote: > hi all - i'm having some difficulty figuring out how to convert > between "user units" (which i can't find a definition for in the > plotrix package) and either (a) device units (e.g. inches with PDFs) > or (b) user coordinates along any particular axis. > > as an example, suppose i set up a PDF device with inches, the device > has both outer and inner magins, and the plot region has drastically > different x and y coordinate ranges (e.g. xlim = c(0, 1), ylim = c(0, > SOME_VERY_LARGE_NUMBER)). > > now i'd like to draw.circle(...) but i can't figure out what units the > radius argument takes. > "user units" doesn't appear to be inches in this case, and it it > corresponds to user coordinates, i don't know which axis' scaling is > to be used as the reference. > > ideally, one would be able to specify the radius in user coordinates > while specifying _which_ axis to use as the standard (e.g. an axis = > "y" or axis = "x" argument). > > getFigCtr(...) can help in figuring this out, but its argument takes > the relative position of the "figure" region, rather than the "plot" > region, which is more apt for properly placing shapes. > > i know the grid package has extensive unit conversion code, but i'm > trying to update a series of figures using only base graphics... > > i can't seem to find a rigorous definition of "user units" anywhere in > the plotrix package. > anyone know of where i can find this info? > > cheers, > > -m > > ______________________________________________ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > -- Gregory (Greg) L. Snow Ph.D. 538...@gmail.com [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.