Skip to content

datasaurus

using CSV, Downloads, DataFrames
using AlgebraOfGraphics, CairoMakie
using Statistics

https://github.com/jumpingrivers/datasauRus https://www.autodesk.com/research/publications/same-stats-different-graphs

link = "https://raw.githubusercontent.com/jumpingrivers/datasauRus/main/inst/extdata/DatasaurusDozen-Long.tsv"
file = Downloads.download(link)
dsaurus = CSV.read(file, DataFrame, delim = '\t')

plt = data(dsaurus) * mapping(:x => "", :y => "", layout=:dataset)
with_theme(theme_light(), resolution = (1600,1200), fontsize = 24) do
    draw(plt) ## palettes = (layout=wrap(cols=3),)
end

ggplot2 theme¤

with_theme(theme_ggplot2(), resolution = (1600,1200), fontsize = 24) do
    fig = Figure()
    g = GridLayout(fig[1,1])
    wfacet = draw!(g, plt)
    bxs = [Box(g[i,j, Top()], color = (:grey70, 0.95),
        strokevisible = false) for i in 1:4 for j in 1:4]
    [translate!(bxs[i].blockscene, 0,0,-1) for i in 1:15]
    delete!.(bxs[14:end])
    fig
end