Last active
January 14, 2020 19:32
-
-
Save hepplerj/9de414570b348cb1dffb5062bb65a674 to your computer and use it in GitHub Desktop.
Hex logo generator for R User Group
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(hexSticker) | |
library(tidyverse) | |
library(tidycensus) | |
library(sf) | |
library(viridis) | |
options(tigris_use_cache = TRUE) | |
nebraska_raw <- get_acs(state = "NE", | |
geography = "tract", | |
variables = "B01003_001", | |
geometry = TRUE) | |
area <- nebraska_raw %>% | |
select(geometry) %>% | |
st_area() %>% | |
as.numeric() | |
nebraska <- bind_cols(nebraska_raw, tibble(area = area)) | |
ne <- nebraska %>% | |
ggplot(aes(fill = log2((estimate + 25) / area), | |
color = log2((estimate + 25) / area))) + | |
geom_sf() + | |
scale_fill_viridis(begin=.3, end=.9) + | |
scale_color_viridis(begin=.3, end=.9) + | |
theme_minimal() + | |
theme(legend.position="none") + | |
theme(axis.text.x=element_blank(), | |
axis.text.y=element_blank(), | |
panel.grid.major = element_line(colour = "transparent")) + | |
theme_transparent() | |
ne | |
# Logo | |
sysfonts::font_add_google("Josefin Sans", "josefin") | |
sticker(ne, | |
package = "UNOR", | |
p_size = 12.5, | |
p_y = 1, | |
p_family = "josefin", | |
p_color = "#ffffff", | |
h_fill = "#453781FF", | |
h_color = "#ffffff", | |
h_size = 2, | |
s_x = 1, s_y = 1, | |
s_width = 4.9, s_height = 4.9, | |
url = "github.com/unolibraries/", | |
u_color = "#ffffff", | |
u_size = 1.2, | |
filename="unor_hex.png") | |
# UNO logo version | |
img <- "https://upload.wikimedia.org/wikipedia/commons/c/c6/University_of_Nebraska_Omaha_%22O%22.png" | |
sticker(img, package="r-mavs", | |
p_size=12, p_y = 1.5, s_x = 1, s_y = 0.75, s_width = 0.5, s_height = 0.5, | |
p_family = "josefin", | |
h_fill = "#FFFFFF", p_color = "#D71920", h_color = "#D71920", | |
filename="unor_hex2.png") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment