I have some survey data where I have the number of times a factor gets mentioned during interviews and then the percentage of how many each of these mentions are either positive, neutral or negative. I would like to display this in a circular stacked barchart, with each segment of the plot showing the percentage of the responses for each factor that are positive/neutral/negative and the width of each bar/segment representing the number of responses relating to each factor. I have been able to achieve this using ggplot and coord_polar but the problem I'm having is that each factor around the circle is evenly spaced leaving a gap between the bars. But I was wondering if it is possible to change the position of these factors around the circle resulting in a 'full' pie chart with different sized segments but without gaps between them?
This is what I've done so far;
data <- data.frame(Factor = c("One", "Two", "Three", "Four", "Five", "Six"),
responses = c(23,16,8,16,17,20),
positive = c(65.2,56.3,25,68.8,76.4,50),
neutral =c(30.4,12.5,25,12.5,17.6,20),
negative=c(4.3,31.3,50,18.8,5.9,30))
data2 <-melt(data, id=c("Factor","responses"))
data2$Factor <- factor(data2$Factor, levels = c("One", "Two", "Three",
"Four", "Five","Six"))
ggplot(data2) +
geom_bar(aes(Factor, value, fill=variable, width=responses/25), stat="identity", alpha=0.5) +
coord_polar()
Which produced this;
But I'd like something closer to this, in terms of the width of the segments filling the circle, but then to have each segment stacked as above;
Any help would be greatly appreciated! Thanks