data-raw/hex_sticker.R

library(tidyverse)
library(hexSticker)
library(showtext)

## Loading Google fonts (http://www.google.com/fonts)
font <- "Roboto Mono"
font_add_google(font)
## Automatically use showtext to render text for future devices
showtext_auto()

chi11_1k_expr <- read_tsv(file.path("data-raw", "chi11_1k.tsv"))

grouped <- group_by(chi11_1k_expr, sample_id, stim_type)
one_group <- group_split(grouped)[[1]]

state_marker <- "pSTAT3"
one_marker <- one_group[state_marker]

p <- ggplot(one_marker, aes(x = !!ensym(state_marker))) +
  geom_density(color="#FDDA0D", fill="#FFFF8F")
p <- p + theme_void() + theme_transparent()

s <- sticker(p, package="HDStIM", p_size=20.5, p_family = font, p_x = 1, p_y = 1.45,
             s_x=1, s_y=.8, s_width=1, s_height=0.9,
             h_fill="#6B6966", h_color="#010203", h_size = 1, dpi = 300,
             filename=file.path("man","figures","sticker.png"))

# https://www.december.com/html/spec/color1.html

plot(s)
niaid/HDStIM documentation built on Oct. 15, 2023, 4:43 p.m.