In the proof of concept phase of a dashboard project it is often necessary to fill the page with mockup charts and figures. I have found one that not only fills the space, but serves as a reliable icebreak, especially with clients who grew up in the 1980’s and 1990’s.

Resorting to use an image would be cheating, and so the infographic consists only of legit R code.

The code to generate the infographic is following:

# pacman!

library(tidyverse)
library(grid)
library(gridExtra)

frmPacman <- data.frame(text = c('not Pacman', 'Pacman'),
                        value = c(1, 5))

frmEye <- data.frame(text = c('Pacman'),
                     value = c(pi * 1.25))


ggpPacman <- ggplot(frmPacman, aes(x = "", y = value, fill = text)) +
  geom_col(width = 1) +
  geom_point(data = frmEye, aes(x = "", y = value), fill = "black", size = 10) +
  coord_polar("y", start = 2 * pi / 3) +
  scale_fill_manual(values = c("grey40", "yellow"),
                    guide = guide_legend(reverse = T)) +
  theme_void() +
  theme(legend.title = element_blank(),
        panel.background = element_rect(fill = "grey40"),
        legend.key.size = unit(1.7, 'lines'),
        legend.text = element_text(size = 14),
        legend.spacing = unit(3, 'lines'))


grid.arrange(textGrob("Pacman: a study", 
                      gp = gpar(fontsize = 2.5*11, fontface = "bold")), 
             ggpPacman, 
             heights = c(0.17, 1))