Hex Stickers

Creation of hex stickers with R


# devtools::install_github("derekmichaelwright/agData")
library(agData)
library(hexSticker)

dblogr

# Prep data
xx <- read.csv("data_dblogr.csv") %>%
  group_by(Entry) %>%
  summarise(Value = mean(DTF))
mp <- ggplot(xx, aes(x = "", y = Value)) +
  geom_boxplot(fill = "darkgreen", alpha = 0.8) +
  scale_y_reverse() +
  coord_flip() +
  theme_void() +
  theme(plot.caption = element_text(size = 20, hjust = 0.5, family = "Aller_Rg")) +
  labs(caption = "www.dblogr.com/")
#
sticker(filename="logo_dblogr.png", package="dblogr", 
        p_size = 35, p_x = 1, p_y = 1.3, p_color = "black",
        # Logo
        mp, s_x = 1, s_y = 0.75, s_width = 1.5, s_height = 0.6,
        # Border
        h_fill = "grey90", h_color = "darkgreen", h_size = 1.5,
        # Url
        url = "derekmichaelwright.github.io/dblogr/", 
        u_color = "black", u_x = 1, u_y = 0.09, u_size = 4 )

agData

# Prep data
xx <- agData_FAO_Crops %>% 
  filter(Area == "Canada", Item == "Lentils, dry", 
         Measurement == "Production", Year < 2021)
# Create sticker
mp <- ggplot(xx, aes(x = Year, y = Value) ) + 
  geom_line(size = 1) + 
  theme_void()
#
sticker(filename = "logo_agData.png",
        package = "agData", p_color = "black",
        p_x = 0.8, p_y = 1.3, p_size = 27,
        # Logo
        mp, s_x = 1, s_y = 1, 
        s_width = 1.5, s_height = 1,
        # Border 
        h_fill = "grey90", h_color = "darkgreen", h_size = 1.5,
        # Url
        url = "github.com/derekmichaelwright/agData/", 
        u_color = "black", u_x = 1, u_y = 0.09, u_size = 3.75 )

gwaspr

# Prep data
xx <- read.csv("gwas_results.csv")
myColors <- c("black", "darkgreen", "black", "darkgreen",
              "black", "darkgreen", "black")
# Create sticker
mp <- ggplot(xx, aes(x = Position, y = -log10(P.value), 
                     color = factor(Chromosome))) + 
  geom_point(size = 0.1) + 
  facet_grid(. ~ Chromosome, scales = "free_x", space = "free_x") +
  scale_color_manual(values = myColors) +
  theme_void() +
  theme(legend.position = "none",
        strip.text.x = element_blank(),
        panel.spacing = unit(0.1, "lines")) 
#
sticker(filename = "logo_gwaspr.png",
        package = "gwaspr", p_color = "black",
        p_x = 1, p_y = 1.4, p_size = 30,
        # Logo
        mp, s_x = 1, s_y = 0.9, 
        s_width = 1.5, s_height = .6,
        # Border 
        h_fill = "grey90", h_color = "darkgreen", h_size = 1.5,
        # Url
        url = "github.com/derekmichaelwright/gwaspr/", 
        u_color = "black", u_x = 1, u_y = 0.09, u_size = 3.75 )

cypher

mp <- ggplot() + theme_void() +
  geom_text(aes(x = 1, y = 1, label = "abc -> ### -> abc"), size = 12.5)
sticker(filename="logo_cypher.png", package="cypher", 
        p_size = 40, p_x = 1, p_y = 1.25, p_color = "black",
        subplot = mp,
        s_x = 1, s_y = 0.7, s_width = 1.5,
        # Border
        h_fill = "grey90", h_color = "darkgreen", h_size = 1.5,
        # Url
        url = "github.com/derekmichaelwright/cypher/", 
        u_color = "black", u_x = 1, u_y = 0.09, u_size = 3.75 )

© Derek Michael Wright