[R] ggplot2 rose diagram

Tim Howard tghoward at gw.dec.state.ny.us
Tue Mar 9 15:25:42 CET 2010

Dear R gurus - 

consider this plot:

dat <- sample(1:8,100,replace=TRUE)
smp <- ggplot(data.frame(dat), aes(x=factor(dat),fill=factor(dat))) + geom_bar(width=1)
smp + coord_polar() 

Q1. How do I change the font size and weight of bar labels (1,2,3...)?  I've been wallowing in the 'Themes' structure and I just can't figure out the correct place to change the definitions. Along these same lines, what does 'strip' mean when referring to strip text? 

Q2. How can I move the legend defining bar height into the plot, so that it overlays the lines they refer to?

Consider the same figure using Circstats:

dat.rad <- (dat*((2*pi)/8)) -(2*pi)/16
rose.diag(dat.rad, bins = 8)  #note the origin is to the right rather than on top

Q3. The key difference is that CircStats uses an area-based calculation for the size of each slice, which makes for a different presentation than ggplot2. Any suggestions on how to use this calculation method in the ggplot framework? 

Thanks in advance for your help.
Tim Howard
New York Natural Heritage Program

More information about the R-help mailing list