I have the following code and data

data.csv

"","Goal","Frequency","Weight","Group"
"1","Move",13,0.245283018867925,"Public"
"2","Create",10,0.188679245283019,"Public"
"3","Strengthen",30,0.566037735849057,"Public"
"4","Move",6,0.6,"Board"
"5","Create",0,0,"Board"
"6","Strengthen",4,0.4,"Board"
"7","Move",19,0.301587301587302,"Total"
"8","Create",10,0.158730158730159,"Total"
"9","Strengthen",34,0.53968253968254,"Total"

code

q1.3 <- read.csv("data.csv")
p <- ggplot(data=q1.3,
            aes(x=factor(1),
                y=Weight,
                fill=factor(Goal))) +
            ggtitle("Respondents Goal Preference") +
            geom_bar(width = 1) +
            facet_grid(Group ~ .) +
scale_fill_manual(values=c("#BED2FF","#0070FF","#004DA8")) +
            coord_polar(theta="y") +
            xlab('') +
            ylab('') +
            labs(fill='Goal') +
            theme(
              plot.title = element_text(lineheight=.8, face="bold"),
panel.background = element_rect(fill = "transparent",colour = NA),
              panel.grid.minor = element_blank(),
              panel.grid.major = element_blank(),
strip.background = element_rect(fill = "transparent",colour = NA),
              strip.text.y = element_text(face="bold", size=10),
plot.background = element_rect(fill = "transparent",colour = NA), axis.ticks = element_blank(), axis.text.y = element_blank(), axis.text.x = element_blank()
  )

to produce a chart which is close to what I want.  I just need two changes

I would like the facet labels (Board, Public, and Total) to appear horizontally above (or below) the pie charts. I do want to keep the pie charts oriented vertically. and I would like to label the wedges of the pie charts with their associated values.

Is that possible and if so how?

______________________________________________
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.

Reply via email to