Skip to content

Instantly share code, notes, and snippets.

@darokun
Created September 17, 2021 09:48
Show Gist options
  • Select an option

  • Save darokun/ec760109a38c48cef658fd9057d84e04 to your computer and use it in GitHub Desktop.

Select an option

Save darokun/ec760109a38c48cef658fd9057d84e04 to your computer and use it in GitHub Desktop.
# install.packages("ggchicklet", repos = "https://cinc.rud.is")
library(ggchicklet)
library(tidyverse)
x <- rep(letters[1:7], seq.int(0, 30, 5))
hb <- tibble(x)
hex_codes1 <- scales::hue_pal()(length(unique(hb$x)))
p1 <- ggplot(count(hb, x), aes(x = x, y = n)) +
geom_chicklet(radius = grid::unit(2, 'mm'), fill = hex_codes1, colour = "black") +
theme_void() +
theme(legend.position = "none") +
# labs(title = "After detailed analysis,\n we conclude that your age and wisdom are growing\n in a very reliable way.") +
geom_segment(aes(x = "b", y = 10, xend = "c", yend = 10+10), colour = "red", size = 2.5, lineend = "round") +
geom_segment(aes(x = "c", y = 10+10, xend = "c", yend = 10+10-5), colour = "red", size = 2.5, lineend = "round") +
geom_segment(aes(x = "c", y = 10+10-5, xend = "d", yend = 10+10-5+10), colour = "red", size = 2.5, lineend = "round") +
geom_segment(aes(x = "d", y = 10+10-5+10, xend = "d", yend = 10+10-5+10-5), colour = "red", size = 2.5, lineend = "round") +
geom_segment(aes(x = "d", y = 10+10-5+10-5, xend = "e", yend = 10+10-5+10-5+10), colour = "red", size = 2.5, lineend = "round") +
geom_segment(aes(x = "e", y = 10+10-5+10-5+10, xend = "e", yend = 10+10-5+10-5+10-5), colour = "red", size = 2.5, lineend = "round") +
geom_segment(aes(x = "e", y = 10+10-5+10-5+10-5, xend = "f", yend = 10+10-5+10-5+10-5+10), colour = "red", size = 2.5, lineend = "round") +
geom_segment(aes(x = "f", y = 10+10-5+10-5+10-5+10, xend = "f", yend = 10+10-5+10-5+10-5+10-5), colour = "red", size = 2.5, lineend = "round") +
geom_segment(aes(x = "f", y = 10+10-5+10-5+10-5+10-5, xend = "g", yend = 10+10-5+10-5+10-5+10-5+10),
arrow = arrow(length = unit(1.5, "cm")), colour = "red", size = 2.5, lineend = "round")
p1 <- gridExtra::grid.arrange(grid::textGrob("After detailed analysis,\n we conclude that your age and wisdom\n are growing in a very reliable way.\n\n HAPPY BIRTHDAY!",
gp = grid::gpar(fontsize = 2.5*11, fontface = "bold")),
p1,
heights = c(2, 4))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment