Skip to content

Commit

Permalink
add coloured logo
Browse files Browse the repository at this point in the history
  • Loading branch information
lschneiderbauer committed Dec 29, 2024
1 parent e1f8f4a commit 730cdc7
Show file tree
Hide file tree
Showing 2 changed files with 392 additions and 0 deletions.
50 changes: 50 additions & 0 deletions data-raw/hex-logo-colour.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
library(hexSticker)
library(tidyverse)
library(showtext)
library(svglite) # to produce an svg

## Loading Google fonts (http://www.google.com/fonts)
# font_add_google("Tiny5", db_cache = FALSE)
# font_add_google("Micro 5", db_cache = FALSE)


morlet <- function(x, sigma) {
exp(-x^2) * sin(2 * pi * x * sigma)
}

p <-
tibble(x = seq(-2.5, 2.5, by = 0.025)) |>
mutate(
y = morlet(x, 1),
c = max(x) - abs(x)
) |>
ggplot(aes(x = x, y = y, colour = c)) +
# geom_line(linewidth = 1.5) +
geom_point(size = 0.8, shape = "square") +
scale_color_viridis() +
theme_void() +
theme(
legend.position = "none"
)
p

# hexSticker conventions (by experiment)
# (x,y) = (1,1) seems to be the center of hex
# (x,y) = (0,0) is left bottom corner

sticker(
p,
package = "",
s_x = 1, s_y = 1,
s_width = 2, s_height = 1.6,
h_fill = "black", #viridis(1),
h_color = viridis(1),
url = "fCWTr",
#u_size = 26, # 26 for png
u_size = 9, # for svg
u_family = "Micro 5",
u_x = 1.15,
u_y = 0.23,
u_color = viridis(1, begin = 1),
filename = "inst/figures/hex-logo-color.svg"
) |> plot()
Loading

0 comments on commit 730cdc7

Please sign in to comment.