Skip to content

Instantly share code, notes, and snippets.

@codementum
Created February 1, 2017 00:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save codementum/87e0feb38cf85f0892489a78c071083d to your computer and use it in GitHub Desktop.
Save codementum/87e0feb38cf85f0892489a78c071083d to your computer and use it in GitHub Desktop.
Plot of refugee data for Worcester MA (2012 counts) and status (as of Jan 31 2017)
refugees <- data.frame(
country = c("Iraq", "Bhutan", "Burma", "Burundi", "Somalia", "Liberia", "Vietnam", "Congo", "CAR", "Ethiopia", "Other"),
number = c(837, 617, 272, 112, 101, 45, 38, 34, 29, 11, 100),
Status = c("BANNED", "PERMITTED", "PERMITTED", "PERMITTED", "BANNED", "PERMITTED", "PERMITTED", "PERMITTED", "PERMITTED", "PERMITTED", "UNKNOWN")
)
palette <- cbPalette <- c("#D55E00", "#0072B2", "#CC79A7")
ggplot(data = refugees) +
geom_col(mapping = aes(x = reorder(country, -number), y = number, fill = Status)) +
scale_fill_manual(values = palette) +
labs(
title = "Refugee Counts and Status in Worcester, MA",
subtitle = "\"With more than 2,000 refugees from 24 countries settling in Worcester during\nfive years surveyed, Worcester is the state's leading destination for people\nescaping persecution in their homelands.\" - George Barnes @georgebarnesTG",
caption = "Counts as of 2012. Data from\nClark University's Mosakowski Institute for Public Enterprise\nhttp://www.telegram.com/article/20150312/NEWS/303129577",
x = "Country",
y = "Counts",
fill = ""
) +
theme_bw() +
theme(axis.text.x = element_text(size=7)) +
theme(legend.position = "bottom")
ggsave("refugees.png", width = 6, height = 5, units = "in", device="png")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment