https://github.com/mkearney/inaug_crowd_size
Plot of inaugural crowd sizes
https://github.com/mkearney/inaug_crowd_size
crowd-size donald-trump ggplot2 inauguration politics r r-ggplot2
Last synced: 7 months ago
JSON representation
Plot of inaugural crowd sizes
- Host: GitHub
- URL: https://github.com/mkearney/inaug_crowd_size
- Owner: mkearney
- Created: 2017-01-22T03:38:19.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2017-01-22T04:45:06.000Z (over 8 years ago)
- Last Synced: 2025-01-15T09:45:46.494Z (9 months ago)
- Topics: crowd-size, donald-trump, ggplot2, inauguration, politics, r, r-ggplot2
- Language: R
- Size: 129 KB
- Stars: 4
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## Inaugural Crowd Size Plot
Script used to generate plots included below and saved in `inaugsize.R` file.

## Metro Ridership Plot

## Inaugural Crowd Size code
```{r}
## data from politifact link here:
## http://www.politifact.com/truth-o-meter/article/2017/jan/20/inaugural-crowd-sizes-ranked/
df <- data.frame(
year = seq(1989, 2017, 4),
president = c("Bush I", "Clinton", "Clinton",
"Bush", "Bush", "Obama", "Obama", "Trump"),
party = c("R", "D", "D", "R", "R", "D", "D", "R"),
term = c(1, 1, 2, 1, 2, 1, 2, 1),
inaug.size = c(300000, 800000, 250000, 300000, 400000,
1800000, 1000000, 250000)
)## load ggplot2
library(ggplot2)## create plot
## uncomment next line and final line (dev.off()) to save img
## png("inaugsize.png", 6, 4, "in", res = 127.5)
ggplot(df, aes(year, inaug.size, fill = party)) +
geom_bar(stat = "identity") +
theme_minimal() +
theme(text = element_text(family = "Avenir Next Condensed"),
plot.title = element_text(face = "bold", size = 18),
legend.position = "none",
axis.text.x = element_text(
color = "black", size = 10)) +
scale_fill_manual(values = c("#003399", "#aa3333")) +
scale_x_continuous(
breaks = seq(1989, 2017, 4),
labels = c("Bush I", "Clinton", "Clinton", "Bush",
"Bush", "Obama", "Obama", "Trump")) +
scale_y_continuous(
breaks = seq(250000, 2000000, 500000),
labels = c("250k", "750k", "1.25m", "1.75m")) +
labs(x = "", y = "Inauguration Crowd Size",
title = "Inauguration crowd sizes since 1989",
subtitle = "Crowd size estimates from PolitiFact")
## dev.off()
```## Metro Ridership Code
```{r}
## metro ridership data as reported by @wmata twitter feed
## https://twitter.com/wmata
## all estimates are as of 11am on the day of the events
metro <- data.frame(
event = c("Bush Inaug\n2005",
"Obama Inaug\n2009",
"Obama Inaug\n2013",
"Trump Inaug\n2017",
"#WomensMarch\n2017"),
ridership = c(197000, 513000, 317000, 193000, 275000)
)
## fix factor order
metro$event <- factor(metro$event, levels = metro$event)## load ggplot2
library(ggplot2)## uncomment following and dev.off() lines to save png
## png("metroride.png", 6, 4, "in", res = 127.5)
ggplot(metro, aes(x = event, y = ridership, fill = event)) +
geom_bar(stat = "identity") +
theme_minimal() +
theme(text = element_text(family = "Avenir Next Condensed"),
plot.title = element_text(face = "bold", size = 16),
legend.position = "none",
axis.text.x = element_text(
color = "black", size = 10)) +
scale_fill_manual(values = c(
"#aa3333", "#003399", "#003399",
"#aa3333", "#aa3399")) +
scale_y_continuous(
breaks = seq(0, 600000, 150000),
labels = c("0", "150k", "300k", "450k", "600k")) +
labs(x = "", y = "Metro ridership at 11am",
title = "Metro Ridership of Inaugurations and #WomensMarch",
subtitle = paste0(
"Estimates reported by @wmata the official ",
"feed of Metro/WMATA"))
## dev.off()
```