Created
May 28, 2020 18:30
-
-
Save hafen/e3641ae5a24b49f4ae4b393fad9f201b to your computer and use it in GitHub Desktop.
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(geofacet) | |
library(ggplot2) | |
# original plot | |
ggplot(election, aes(candidate, votes / 1000000, fill = candidate)) + | |
geom_col() + | |
scale_fill_manual(values = c("#4e79a7", "#e15759", "#59a14f")) + | |
facet_geo(~ state, grid = "us_state_grid2") + | |
coord_flip() + | |
ylab("Votes (millions)") | |
# shrink facet labels | |
ggplot(election, aes(candidate, votes / 1000000, fill = candidate)) + | |
geom_col() + | |
scale_fill_manual(values = c("#4e79a7", "#e15759", "#59a14f")) + | |
facet_geo(~ state, grid = "us_state_grid2") + | |
coord_flip() + | |
ylab("Votes (millions)") + | |
theme(strip.text.x = element_text(size = 6, margin = margin(0.5, 0, 0.5, 0, "mm"))) | |
# remove facet labels | |
ggplot(election, aes(candidate, votes / 1000000, fill = candidate)) + | |
geom_col() + | |
scale_fill_manual(values = c("#4e79a7", "#e15759", "#59a14f")) + | |
facet_geo(~ state, grid = "us_state_grid2") + | |
coord_flip() + | |
ylab("Votes (millions)") + | |
theme(strip.background = element_blank(), strip.text.x = element_blank()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment