[R] Symbol size in plot relative to axis scale and not the graphics window

Jim Lemon jim at bitwrit.com.au
Fri Feb 17 07:35:08 CET 2012

On 02/16/2012 10:39 PM, Hey, Kirsty wrote:
> Dear all,
> I am wanting to plot points that have a defined absolute size relative
> to the scale of the axis.
> For example, the following gives me a plot with sizes relative to the
> defined "size" variable but are not of the specified absolute size
> (relative to the axis)
> coords<- as.data.frame(matrix(c(c(0,0),c(5,5),c(0,3)), 3, 2))
> coords$radius<- c(1.4112, 2.34, 1.4573)
> coords$size<- 2*coords$radius
> plot(coords[,1:2], cex=coords[,4])
Hi Kirsty,
As you seem to be using the small circle (pch=1), you could use 
draw.circle (plotrix) instead. The three relevant arguments are:

x,y (x and y coordinates of the circle in user units)
radius (radius of the circle in user units)

For example:


You can also change the color, width and line type of the circumference 
and fill the circles if you wish.


More information about the R-help mailing list