ggplot donut chart - pie output

Hello people of stack overflow

I have followed code from a previous thread ggplot Donut chart

However when displaying said 'donut graph' R turns out a pie chart. How do I get a donut chart?

I'm new to R and ggplot. Tut tut for using donuts I know.

## add columns for drawing with geom_rect microcolour.df$Percentage = microcolour.df$Freq / sum(microcolour.df$Freq)*100 microcolour.df = microcolour.df[rev(order(microcolour.df$Percentage)), ] microcolour.df$ymax = cumsum(microcolour.df$Percentage) microcolour.df$ymin = c(0, head(microcolour.df$ymax, n=-1)) microcolour.df  ## reorder colour levels print(levels(microcolour.df$Colour)) microcolour.df$Colour <- reorder(microcolour.df$Colour,                              new.order = c(10, 1, 9, 5, 2, 11, 4, 8, 7, 6, 3))  ## create donut ggplot(microcolour.df, aes(fill = Colour, ymax = ymax, ymin = ymin, xmax = 100, xmin = 0)) + geom_rect(colour = "black") + coord_polar(theta = "y") +  xlim(c(0, 100)) + theme(panel.grid=element_blank()) + theme(axis.text=element_blank()) + theme(axis.ticks=element_blank()) 

Any help or words of wisdom would be greatly appreciated. I will modify colours etc after I get round this blip.

Thank you

Replay

Category: r Time: 2016-07-29 Views: 0

Related post

iOS development

Android development

Python development

JAVA development

Development language

PHP development

Ruby development

search

Front-end development

Database

development tools

Open Platform

Javascript development

.NET development

cloud computing

server

Copyright (C) avrocks.com, All Rights Reserved.

processed in 0.145 (s). 12 q(s)