pkg <- read.dcf(here::here("DESCRIPTION"), fields = "Package")[1]
description <- read.dcf(here::here("DESCRIPTION"), fields = "Description")[1]

# If you're using R<4.1.1, need this version of rvcheck
# devtools::install_version('rvcheck',version='0.1.8') 
library(hexSticker)
library(dplyr)
library(ggplot2)
library(ggimage)
# library(ggpattern)# remotes::install_github("coolbutuseless/ggpattern")

You can make awesome hex stickers for your R packages using:

r pkg

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)

Subplot

# URL <- "https://github.com/NathanSkene/EWCE/releases/download/v1.1/DALL.E.2023-03-10.01.14.58.-.cell.type.specific.gene.enrichment.png"
# tmp <- tempfile(fileext = ".png")
# utils::download.file(URL, tmp)

tmp <- here::here("inst/hex/2BIgqrmzc0GSaaAGOqSeAu.jpg")

hexSticker

# pkg <- paste("E xpression","W eighted","C elltype","E nrichment", sep = "<br>")

s_size = .35
stick <- hexSticker::sticker( 
  subplot = tmp,
  #### Package name ####
  package = paste0(strsplit(pkg, " ")[[1]],collapse = " "),
  p_size=20, p_y = 1.5,  p_color = ggplot2::alpha("white",.95),
  #### Subplot #####
  s_x=1, s_y=1,  s_height = s_size, s_width = s_size*2.4,
  #### Fill & border ####
  h_fill = "#060b1a", h_color =ggplot2::alpha("white",.5),h_size = 2,
  #### Spotlight ####
  spotlight = TRUE, l_alpha = .2, l_width = 5, l_x = .5,
  #### File output ####
  white_around_sticker = TRUE,
  filename = filename, dpi = 300)
print(stick)

Session Info

utils::sessionInfo()



NathanSkene/EWCE documentation built on April 10, 2024, 1:02 a.m.