pictogram example
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1.1 KiB

title author date output
[{html_document [{keep_md true} {theme simplex} {highlight monochrome}]}]
library(hrbrthemes)
library(waffle) # install from github/etc.
library(tidyverse)

xdf <- read_csv(here::here("data/ghlp.csv"), col_types = "cdd")
mutate(xdf, category = fct_inorder(category)) %>%
  gather(measure, value, -category) %>%
  mutate(measure = factor(measure, levels=c("female", "male"))) %>%
  ggplot(aes(label = measure, values = value)) +
  geom_pictogram(n_rows = 1, aes(colour = measure), show.legend = FALSE) +
  scale_x_continuous(expand=c(0,0)) +
  scale_y_continuous(expand=c(0,0)) +
  scale_colour_manual(
    values = c(
      "female" = "#09394c",
      "male" = "#a8a8a8"
    )
  ) +
  scale_label_pictogram(
    name = NULL,
    values = c("female", "male"),
    labels = c("female", "male")
  ) +
  facet_wrap(~category, ncol = 1) +
  theme_ipsum_es(grid="", panel_spacing = unit(0, "lines")) +
  theme_enhance_waffle()


title: "glhp-isotype.R" author: "hrbrmstr" date: "2019-09-14"