library(ggplot2)
library(ggforma)

counts <- marginSums(HairEyeColor, c("Hair", "Eye"))
set.seed(137)
simulation <- mosaic_max_test(counts, n = 999L)
ggmosaic(counts, shade = simulation, labeling = "border", label = NULL) +
  labs(title = "Fixed-margin maximum residual calibration",
       subtitle = "999 null draws across all cells of a two-way table")
