data-raw/hex.R

#install.packages("hexSticker")
library(hexSticker)
library(ggplot2)
pkg <- basename(getwd())
img <- "data-raw/hexsubplot.png"
out <- paste0(c("data-raw/", "inst/"), pkg, ".png")

hex_plot <- function(out, mult = 1){
  sticker(img, 1, 1, 0.75, 0.75, pkg, p_x = 1, p_size = mult * 28, p_color = "lightcyan", h_size = mult * 1.2, h_fill = "black",
          h_color = "steelblue", url = paste0("leonawicz.github.io/", pkg), u_color = "lightcyan", u_size = mult * 3,
          filename = out)
  # overwrite file for larger size
  ggsave(out, width = mult*43.9, height = mult*50.8, bg = "transparent", units = "mm")
}

hex_plot(out[1], 4) # multiplier for larger sticker size
hex_plot(out[2])
leonawicz/mapmate documentation built on May 21, 2019, 5:09 a.m.