Skip to content

Instantly share code, notes, and snippets.

@mdshw5
Last active June 8, 2021 01:25
Show Gist options
  • Save mdshw5/10a739c2adeb3ce48cea189a104c8cd9 to your computer and use it in GitHub Desktop.
Save mdshw5/10a739c2adeb3ce48cea189a104c8cd9 to your computer and use it in GitHub Desktop.
some jokey charts
title <- "Kinds of sunscreen I get to use:"
names <- c("SunSport Waterproof SPF30",
"The organic zinc kids one",
"The moisturizing one",
"The expensive one",
"The one I like")
colors <- c("#EFD8B5", "#F9EDD4", "#CDE2CE", "#82C6BD", "#5BB6CC")
data <- data.frame(values=c(80,12,5,2,1), names=factor(names, levels=names))
library(ggplot2)
library(xkcd)
ggplot(data, aes(x="", y=values, fill=names)) +
geom_bar(stat="identity", width=1) +
coord_polar("y", start=0) +
theme_xkcd() +
scale_fill_manual(name="Sunscreen Types", values=colors) +
theme(axis.title.x=element_blank(),
axis.text.x=element_blank(),
axis.ticks.x=element_blank(),
plot.title = element_text(hjust = 0.5)) +
ggtitle("Kinds of sunscreen I get to use")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment