[R] PLotting R graphics/symbols without user x-y scaling

Gabor Grothendieck ggrothendieck at gmail.com
Tue Feb 27 02:00:53 CET 2007


You can use par("usr") to get the min/max coords of the plot and then
use that.  For example, this will plot a red dot in the middle of the
plot area regardless of the coordinates:

plot(1:10)  # sample plot
usr <- par("usr")
points(mean(usr[1:2]), mean(usr[3:4]), pch = 20, col = "red") # red dot

See ?par

On 2/26/07, Jonathan Lees <jonathan.lees at unc.edu> wrote:
>
> Is it possible to add lines or other
> user defined graphics
> to a plot in R that does not depend on
> the user scale for the plot?
>
> For example I have a plot
> plot(x,y)
> and I want to add some graphic that is
> scaled in inches or cm but I do not want the
> graphic to change when the x-y scales are
> changed - like a thermometer, scale bar or
> other symbol -
> How does one do this?
>
> I want to build my own library of glyphs to add to plots
> but I do not know how to plot them when their
> size is independent of the device/user coordinates.
>
> Is it possible to add to the list
> of symbols in the function symbols()
> other than:
>  _circles_, _squares_, _rectangles_, _stars_, _thermometers_, and
>      _boxplots_
>
> can I make my own symbols and have symbols call these?
>
>
> Thanks-
>
>
> --
> Jonathan M. Lees
> Professor
> THE UNIVERSITY OF NORTH CAROLINA AT CHAPEL HILL
> Department of Geological Sciences
> Campus Box #3315
> Chapel Hill, NC  27599-3315
> TEL: (919) 962-0695
> FAX: (919) 966-4519
> jonathan.lees at unc.edu
> http://www.unc.edu/~leesj
>
> ______________________________________________
> R-help at stat.math.ethz.ch 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.
>



More information about the R-help mailing list