#### Install deps ####
for(p in c("hexSticker","dplyr","here")){
    if(!require(p,character.only = TRUE)) install.packages(p)     
}
#### Get package metadata deps ####
pkg <- read.dcf(here::here("DESCRIPTION"), fields = "Package")[1]
description <- read.dcf(here::here("DESCRIPTION"), fields = "Description")[1]

Create hex sticker

Hex stickers are a great way to give your R package its very own logo. See here for some examples from other packages.

Here are some R packages that you may find helpful for making hex stickers:

hexSticker

Helper functions for creating reproducible hexagon sticker purely in R.

ggimage

Supports image files and graphic objects to be visualized in ggplot2 graphic system.

ggpattern

Custom ggplot2 geoms which support filled areas with geometric and image-based patterns.

magick

Advanced Image-Processing in R.

aRtsy

R package for making generative art using ggplot2.

threed

Three-Dimensional Object Transformations.

Create file path

Create file path to save hex sticker to.

filename <- here::here("inst","hex","hex.png")
dir.create(dirname(filename), showWarnings = FALSE, recursive = TRUE)

Make sticker

s_size = 1
da <- sprintf('\u2191') 
stick <- hexSticker::sticker( 
  subplot = here::here("inst/hex/2BIeTx6RN6O00CAaeY68q2.jpg"),
  #### Package name ####
  package = paste(strsplit(paste("Multi",da,"\nScale",da,"\nTarget",da,"\nExplorer"),"")[[1]],collapse=" "), 
  p_size=22, p_y = 1.1, p_color = ggplot2::alpha("white",1),
  #### Subplot #####
  s_x=1, s_y=1,  s_height = s_size, s_width = s_size,
  #### Fill & border ####
  h_fill = "white", h_color = ggplot2::alpha("white",.55), h_size = 2,
  #### Spotlight ####
  spotlight = TRUE, l_alpha = .3, l_width = 10, l_x = .5, l_y = .75,
  #### File output ####
  dpi = 300, filename = filename,white_around_sticker = TRUE,
  url=paste0("github.com/neurogenomics/",pkg), u_size=4, u_color="white",
  lineheight = .25)
print(stick)

Session Info

utils::sessionInfo()



neurogenomics/MultiEWCE documentation built on Sept. 28, 2024, 2:27 a.m.