I was asked to recreate the following style of plot. (Please ignore the question of whether this is a good type of visualization and charitably consider this as adding a colorf
Another base
solution that doesn't rely on plotrix
package:
circular.barplot<-function(values, labels, col, cex){
df<-data.frame(values=sort(values), labels=labels[order(values)])
col<-col[order(values)]
plot(NA,xlim=c(-1.3,1.3),ylim=c(-1.3,1.3),axes=F, xlab=NA, ylab=NA, asp=1)
t<-sapply(df$values,function(x).5*pi-seq(0, 2*pi*x/100,length=1000))
x<-sapply(1:nrow(df),function(x)(.3+x/nrow(df))*cos(t[,x]))
y<-sapply(1:nrow(df),function(x)(.3+x/nrow(df))*sin(t[,x]))
for(i in 1:nrow(df)){
lines(x=x[,i],y=y[,i],col=col[i],lwd=10,lend=1)
text(x[1,i],y[1,i],paste(df$labels[i]," - ",df$values[i],"%",sep=""),
pos=2,cex=cex)
}
}