Intro Thoughts
Status Quo
library(tidyverse)
library(ggchord2)
library(ggplot2)
flows_df <- data.frame(
from = c("USA", "USA", "USA", "China", "China", "Germany"),
to = c("USA", "China", "Germany", "USA", "Germany", "USA"),
freq = c(40, 50, 30, 60, 25, 35)
)
flows_df |> ggplot() + |
aes(source = from, target = to, freq = 1) + |
| geom_chord_diagram() + |
| aes(fill = from) + |
| aes(freq = freq) + |
| aes(fill = from == "China") + |
| ggt.test::scale_fill_logical() + |
| labs(title = "Flows *from* China are a big part of the picture - but less than a quarter") + |
| aes(fill = from == "USA") + |
| labs(title = "Flows *from* and within the USA are greater than the US's inflows") + |
| aes(fill = to == "Germany") + |
| labs(title = "Flows *to* Germany are greater than the flows from Germany") + |
| ggt.test::scale_fill_logical(values = c("grey", "orange")) |
Experiment
# refer to chunk name