Libraries, constants, and plotting set-up.

library(ggplot2)
library(dplyr)
library(purrr)

n <- 14
cols <- seq(1, n/2)

colors <- c(
  "#d33682",  # magenta
  "#dc322f",  # red
  "#cb4b16",  # orange
  "#b58900",  # yellow
  "#859900",  # green
  "#2aa198",  # cyan
  "#268bd2",  # blue
  "#6c71c4",  # violet
  "#993399"   # purple
)

theme_blank <- function() {
  theme(axis.line = element_blank(),
        axis.text.x = element_blank(),
        axis.text.y = element_blank(),
        axis.ticks = element_blank(),
        axis.title.x = element_blank(),
        axis.title.y = element_blank(),
        legend.position = "none",
        panel.background = element_blank(),
        panel.border = element_blank(),
        panel.grid.major = element_blank(),
        panel.grid.minor = element_blank(),
        plot.background = element_blank())
}

plt <- function(data) {
  ggplot() +
    geom_segment(aes(x = x, xend = xend, y = y, yend = yend, color = factor(color)),
                 data = data, size = 0.3) +
    scale_color_manual(values = colors) +
    coord_fixed() +
    theme_blank()
}

Basic building blocks.

blank <- function() {
  data.frame(y = numeric(0),
             yend = numeric(0),
             x = numeric(0),
             xend = numeric(0),
             color = numeric(0))
}

sector <- function() {
  data.frame(
    y = c(0, n, seq(n, 1)),
    yend = c(0, 0, rep(0, n)),
    x = c(n, 0, rep(0, n)),
    xend = c(0, 0, seq(1, n)),
    color = c(0, 0, c(cols, rev(cols))))
}

square <- function() {
  data.frame(
    y = c(0, n, n, n, seq(n, 1), seq(n, 1)),
    yend = c(0, 0, n, 0, rep(0, n), rep(n, n)),
    x = c(n, 0, n, n, rep(0, n), rep(n, n)),
    xend = c(0, 0, 0, n, seq(1, n), seq(1, n)),
    color = c(0, 0, 0, 0, c(cols, rev(cols)), c(cols, rev(cols))))
}

diamond <- function() {
  data.frame(
    y = c(0, n, seq(n, 1), seq(n, 1), seq(-n, -1), seq(-n, -1)),
    yend = c(0, -n, rep(rep(0, n), 4)),
    x = c(n, 0, rep(rep(0, n), 4)),
    xend = c(-n, 0, seq(1, n), seq(-1, -n), seq(1, n), seq(-1, -n)),
    color = c(0, 0, rep(c(cols, rev(cols)), 4)))
}