Code adapted from: http://www.r-bloggers.com/consultants-chart-in-ggplot2/ with changes to work with latest version of ggplot2 & to include error bars.
Prepare data:
require(ggplot2)
# function to compute standard error of mean
se <- function(x) sqrt(var(x)/length(x))
# set seed for reproducible results
set.seed(9876)
# create toy data
DF <- data.frame(variable = as.factor(1:10),
value = sample(10, replace = TRUE))
DF
## variable value
## 1 1 9
## 2 2 4
## 3 3 2
## 4 4 6
## 5 5 5
## 6 6 3
## 7 7 5
## 8 8 7
## 9 9 6
## 10 10 2
Create bar plot:
plot <- ggplot(DF, aes(variable, value, fill = variable)) +
geom_bar(width = 1, stat = "identity", color = "white") +
geom_errorbar(aes(ymin = value - se(DF$value),
ymax = value + se(DF$value),
color = variable),
width = .2) +
scale_y_continuous(breaks = 0:nlevels(DF$variable)) +
theme_gray() +
theme(axis.ticks = element_blank(),
axis.text = element_blank(),
axis.title = element_blank(),
axis.line = element_blank())
plot
Create windrose/polar plot from this bar plot by converting to a polar coordinate system:
plot + coord_polar()
To add gridlines, see: http://www.r-bloggers.com/consultants-chart-in-ggplot2/