Created
December 24, 2011 00:11
-
-
Save sckott/1515754 to your computer and use it in GitHub Desktop.
Simple ggplot2 pie chart function.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
piechart <- function(set) { | |
ggplot(dat[dat$type==set,], aes(x = "", y = pageviews, fill = name)) + | |
theme_bw() + | |
geom_bar(width = 1) + | |
coord_polar(theta = "y") + | |
labs(y="", x='') + | |
opts(panel.border = theme_rect(colour = 'white'), | |
axis.text.x = theme_text(colour='white')) | |
} | |
# Where dat is our data.frame, and set is the level of a factor in a column called 'type' that you want to plot. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment