[R] transparent concentric circles

Jim Lemon jim at bitwrit.com.au
Wed Feb 10 05:24:40 CET 2010


On 02/10/2010 01:20 AM, Karin Lagesen wrote:
> I have a data set which I would like to plot as a set of concentric
> circles. The data represent a count of the number of characteristics
> shared by various elements - an example would look like this:
>
> 1 100
> 2 75
> 3 50
> 4 25
>
> I.e. all four sets share 25 characteristics, three of them share 50
> characteristics, and so on.
>
> I would like to plot these as concentric circles, with the circle size
> preferentially being proportional to the size of the number of elements
> (this is not a must, however). I would also like the colors of the circles
> to become stronger/deeper as we progress to the innermost circle (which
> would be the one containing the number of characteristics shared by all
> four).
>
> Can somebody point me to what I can use to do this?

Hi Karin,
As Barry noted, you can use draw.circle in the plotrix package:

plot(0,xlim=c(-100,100),ylim=c(-100,100),type="n",axes=FALSE,
  main="Set intersection plot",xlab="",ylab="")
par(xpd=TRUE)
draw.circle(0,0,100,col="#ffccff")
draw.circle(0,0,75,col="#ff99ff")
draw.circle(0,0,50,col="#ff44ff")
draw.circle(0,0,25,col="#ff00ff")
par(xpd=FALSE)

These aren't transparent, but if you really need transparency, just add 
the alpha level to the colors. Look at boxed.labels to label the circles.

Jim



More information about the R-help mailing list