Last active
September 21, 2015 13:48
-
-
Save andrewheiss/08c1a5b91e67364930f1 to your computer and use it in GitHub Desktop.
Yoda pie chart
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
library(dplyr) | |
library(ggplot2) | |
df <- data_frame(value = c(5, 5, 0), | |
variable = factor(c("Do ", "Do not ", "Try"), | |
ordered=TRUE)) | |
yoda.plot <- ggplot(df, aes(x = "", y = value, fill = variable)) + | |
geom_bar(width = 1, stat = "identity") + | |
scale_fill_manual(values = c("#7AA42F", "#B3B575", "#5978E1"), name=NULL, | |
guide = guide_legend(override.aes=list(size = 0))) + | |
coord_polar("y", start = pi) + | |
theme_bw(12) + | |
theme(panel.background = element_rect(fill="#ffffff", colour=NA), | |
panel.border=element_blank(), axis.line=element_blank(), | |
panel.grid=element_blank(), axis.ticks=element_blank(), | |
axis.title=element_blank(), axis.text=element_blank(), | |
legend.text=element_text(size=rel(1.2), family="Source Sans Pro Light"), | |
legend.key.size=unit(0.7, "lines"), | |
legend.position="bottom") | |
ggsave(yoda.plot, filename="~/Desktop/yoda_plot.png", | |
width=5, height=5, units="in") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment