Skip to content

Instantly share code, notes, and snippets.

@andrewheiss
Created September 8, 2025 13:26
Show Gist options
  • Save andrewheiss/aec56cd445e4f96d9fffaf8184070f3a to your computer and use it in GitHub Desktop.
Save andrewheiss/aec56cd445e4f96d9fffaf8184070f3a to your computer and use it in GitHub Desktop.
library(tidyverse)
library(ggdiagram)

rect_width <- 1.75
rect_height <- 0.6

clrs <- MetBrewer::met.brewer("Tam")

# set_default_arrowhead(ggarrow::arrow_head_wings(offset = 30, inset = 60))
set_default_arrowhead(
  ggarrow::arrow_head_line(angle = 30, lineend = "round")(length = 1, width = 0.3)
)

ggdiagram(font_family = "IBM Plex Sans Condensed", font_size = 8) +
  {
    gov_prefs <- ob_rectangle(
      label = ob_label(
        "Government<br>preferences",
        color = "white",
        fontface = "bold",
        fill = NA
      ),
      width = rect_width,
      height = rect_height,
      fill = clrs[7],
      color = NA
    )
  } +
  {
    ingo_issue <- ob_rectangle(
      label = ob_label(
        "INGO issue<br>contentiousness",
        color = "white",
        fontface = "bold",
        fill = NA
      ),
      width = rect_width,
      height = rect_height,
      fill = clrs[5],
      color = NA
    ) |>
      place(gov_prefs, "right")
  } +
  {
    enforcement <- ob_rectangle(
      label = ob_label(
        "Enforcement<br>of law",
        color = "white",
        fontface = "bold",
        fill = NA
      ),
      width = rect_width,
      height = rect_height,
      fill = clrs[7],
      color = NA
    ) |>
      place(gov_prefs, where = "below")
  } +
  {
    ingo_prefs <- ob_rectangle(
      label = ob_label(
        "INGO preferences<br>and resources",
        color = "white",
        fontface = "bold",
        fill = NA
      ),
      width = rect_width,
      height = rect_height,
      fill = clrs[5],
      color = NA
    ) |>
      place(ingo_issue, where = "below")
  } +
  {
    ingo_space <- ob_rectangle(
      label = ob_label(
        "INGO<br>operational space",
        color = "black",
        fontface = "bold",
        fill = NA
      ),
      width = rect_width,
      height = rect_height,
      fill = clrs[1],
      color = NA
    ) |>
      place(enforcement, where = 315)
  } +
  connect(
    gov_prefs,
    ingo_issue,
    resect = 1,
    color = "black",
    arrow_fins = arrowhead()#, 
    # length_head = 4, length_fins = 4
  ) +
  connect(gov_prefs, enforcement, resect = 1, color = "black") +
  connect(ingo_issue, enforcement, resect = 2, color = "black") +
  connect(enforcement, ingo_space, resect = 1, color = "black") +
  connect(ingo_prefs, ingo_space, resect = 1, color = "black")

Created on 2025-09-08 with reprex v2.1.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment