Skip to content

Instantly share code, notes, and snippets.

@vgXhc
Created June 25, 2023 22:01
Show Gist options
  • Select an option

  • Save vgXhc/23d0142c8fae4e803abbc74b06124e98 to your computer and use it in GitHub Desktop.

Select an option

Save vgXhc/23d0142c8fae4e803abbc74b06124e98 to your computer and use it in GitHub Desktop.
Code for making the hex sticker for the ntdr package
library(hexSticker)
library(ggplot2)
library(ntdr)
library(cowplot)
library(tidyverse)
bus <- magick::image_read_svg("c:/Users/user1/Downloads/train bus ferry.svg")
madison_bus <- get_ntd(agency = "City of Madison", modes = "MB")
p <- madison_bus |>
filter(value != 0) |>
ggplot(aes(x = month, y = value)) + geom_line(alpha = .7)
p <- p + theme_void() + theme_transparent()
q <- ggdraw() +
draw_image(bus, y = -.25, scale = .58) +
draw_plot(p)
sticker(q, package="ntdr", p_size=26, s_x=1, s_y=.8, s_width=1.3, s_height=1,
p_y = 1.5,
h_fill = "#C8DF52",
h_color = "#DBE8D8",
filename="c:/Users/user1/Desktop/tbd/sticker.png")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment