Hi Jim, Very great help. Bunch of thanks. Yours, Amir -------------------------------------------- On Sun, 6/15/14, Jim Lemon <j...@bitwrit.com.au> wrote:
Subject: Re: [R] How to draw Bubble chart with mini pie charts as bubbles in R To: r-help@r-project.org Date: Sunday, June 15, 2014, 5:10 AM On Sat, 14 Jun 2014 01:03:21 PM Agony wrote: > Dear all, > Good day! > > Could anybody help me how to draw a bubble chart with mini pie charts as > bubbles in R ? Introducing any experiences, books, booklet or source code > will appreciated. > Hi Amir, The floating.pie function (plotrix) might do what you want. For example: # first create a simple function to do the chart pie_bubbles<-function(xpos,ypos,radii,sectors, sector_col=NULL,main="",xlab="",ylab="") { xlim<-c(min(xpos-radii),max(xpos+radii)) ylim<-c(min(ypos-radii),max(ypos+radii)) nbubbles<-length(xpos) if(is.null(sector_col)) { sector_col<-list() for(scol in 1:nbubbles) sector_col[[scol]]<-rainbow(length(sectors[[scol]])) } plot(0,xlim=xlim,ylim=ylim,type="n", main=main,xlab=xlab,ylab=ylab) for(bubble in 1:nbubbles) floating.pie(xpos=xpos[bubble],ypos=ypos[bubble], x=sectors[[bubble]],radius=radii[bubble], col=sector_col[[bubble]]) } # set the x positions xpos<-c(2,4,6,8,10) # and the y positions ypos<-c(4,8,6,10,2) # the radii are the "bubble" radii radii<-c(1,0.5,1.2,0.7,1.3) # these are the sector extents of the pies sectors<-list(1:4,c(5,3,8,6,2),c(3,2,1),c(3,7,5,8),c(2.5,3.7)) # get the plotrix package library(plotrix) pie_bubbles(xpos,ypos,radii,sectors,main="Pie bubbles") The above is pretty basic, but it should get you started. Jim ______________________________________________ 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.