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]) Any help would be much appreciated Regards, Kirsty
Symbol size in plot relative to axis scale and not the graphics window
2 messages · Hey, Kirsty, Jim Lemon
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: plot(coords[,1:2],type="n") draw.circle(coords[,1],coords[,2],coords$radius) You can also change the color, width and line type of the circumference and fill the circles if you wish. Jim