[R] Advice on graphics to design circle with density-shaded sectors

Jim Lemon jim at bitwrit.com.au
Sat Feb 28 11:02:37 CET 2009


John Poulsen wrote:
> Hello,
>
> I am looking for some general advice on which graphics package to use 
> to make a figure demonstrating my experimental design.
>
> I want to design a circle with 7 sectors inside.  Then I will want to 
> shade the sectors depending on densities of observations in the 
> sectors.  I will also want to draw horizontal lines at increments 
> along the sectors to demonstrate different distances out to the end of 
> the sector.
>
> Given this sparse description, does anyone have advice on what package 
> or functions to use in R?
Hi John,
Do you mean something like this?

obs_counts<-tabulate(sample(1:7,100,TRUE))
library(plotrix)
obs_count_col<-color.scale(obs_counts,c(1,0),0,c(0,1))
pie(rep(1,7),main="Colored count sectors",col=obs_count_col)
color.legend(-1.2,-1.2,-0.5,-1.1,c("0","","","",as.character(max(obs_counts))),
 color.scale(seq(0,max(obs_counts),length.out=5),c(1,0),0,c(0,1)),align="rb")

However, I can't quite work out what you mean by horizontal lines on the 
sectors.

Jim




More information about the R-help mailing list