Last active
September 21, 2019 22:50
-
-
Save mine-cetinkaya-rundel/895fa4f02c3b454eea038365485cd63c to your computer and use it in GitHub Desktop.
Needed to put my name on my door, naturally I used #rstats for it
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
# load packages ---------------------------------------------------------------- | |
library(tidyverse) | |
library(patchwork) | |
# m ---------------------------------------------------------------------------- | |
m_df <- tribble( | |
~column, ~height, | |
"h1", 50, | |
"h2", 30, | |
"h3", 10, | |
"h4", 30, | |
"h5", 50 | |
) | |
m_plot <- ggplot(m_df, aes(x = column, y = height)) + | |
geom_col(aes(fill = height)) + | |
scale_fill_viridis_c(begin = 0.5, end = 0, option = "E") + | |
theme(legend.position = "none", | |
axis.text = element_blank(), axis.ticks = element_blank()) + | |
labs(x = NULL, y = NULL) | |
# i ---------------------------------------------------------------------------- | |
i_df <- tribble( | |
~column, ~height, | |
"h1", 30, | |
) | |
i_plot <- ggplot(i_df, aes(x = column, y = height)) + | |
geom_col(aes(fill = height)) + | |
ylim(0, 50) + | |
annotate(x = 1, y = 40, "point", cex = 6, color = "#7C7B78") + | |
annotate(x = 1, y = 40, "point", cex = 5, color = "#FDE725") + | |
scale_fill_viridis_c(begin = 0.5, end = 0, option = "E") + | |
theme(legend.position = "none", | |
axis.text = element_blank(), axis.ticks = element_blank()) + | |
labs(x = NULL, y = NULL) | |
# n ---------------------------------------------------------------------------- | |
n_df <- tribble( | |
~column, ~height, | |
"h1", 50, | |
"h2", 30, | |
"h3", 10, | |
"h4", 50 | |
) | |
n_plot <- ggplot(n_df, aes(x = column, y = height)) + | |
geom_col(aes(fill = height)) + | |
scale_fill_viridis_c(begin = 0.5, end = 0, option = "E") + | |
theme(legend.position = "none", | |
axis.text = element_blank(), axis.ticks = element_blank()) + | |
labs(x = NULL, y = NULL) | |
# e ---------------------------------------------------------------------------- | |
e_df <- tribble( | |
~column, ~height, | |
"h1", 30, | |
"h2", 5, | |
"h3", 5, | |
"h4", 20, | |
"h5", 5, | |
"h6", 5, | |
"h7", 30 | |
) | |
e_plot <- ggplot(e_df, aes(x = column, y = height)) + | |
geom_col(aes(fill = height)) + | |
scale_fill_viridis_c(begin = 0.5, end = 0, option = "E") + | |
theme(legend.position = "none", | |
axis.text = element_blank(), axis.ticks = element_blank()) + | |
labs(x = NULL, y = NULL) + | |
coord_flip() | |
# put it all together ---------------------------------------------------------- | |
m_plot + i_plot + n_plot + e_plot + | |
plot_layout(nrow = 1, widths = c(5, 1, 4, 4)) + | |
plot_annotation( | |
title = "Mine Çetinkaya-Rundel", | |
subtitle = "[email protected]", | |
caption = "IDS student hours: Tuesdays 14:30-16:30, or by appointment" | |
) | |
ggsave(filename = "doortag.png", height = 2.5, width = 5, units = "in") | |
# rayshade --------------------------------------------------------------------- | |
mine <- m_plot + i_plot + n_plot + e_plot + | |
plot_layout(nrow = 1, widths = c(5, 1, 4, 4)) | |
plot_gg(mine) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment