{"spec_id":"strip-basic","library":"makie","language":"julia","code":"# anyplot.ai\n# strip-basic: Basic Strip Plot\n# Library: makie 0.21.9 | Julia 1.11.9\n# Quality: 94/100 | Created: 2026-08-05\n\nusing CairoMakie\nusing Colors\nusing Random\nusing Statistics\n\nRandom.seed!(42)\n\n# --- Theme tokens ------------------------------------------------------------\nconst THEME    = get(ENV, \"ANYPLOT_THEME\", \"light\")\nconst PAGE_BG  = THEME == \"light\" ? colorant\"#FAF8F1\" : colorant\"#1A1A17\"\nconst INK      = THEME == \"light\" ? colorant\"#1A1A17\" : colorant\"#F0EFE8\"\nconst INK_SOFT = THEME == \"light\" ? colorant\"#4A4A44\" : colorant\"#B8B7B0\"\nconst IMPRINT_PALETTE = [\n    colorant\"#009E73\", colorant\"#C475FD\", colorant\"#4467A3\", colorant\"#BD8233\",\n]\n\n# --- Data ----------------------------------------------------------------\n# Ball-bearing diameter (mm) measured across four production batches.\nbatches = [\"Batch A\", \"Batch B\", \"Batch C\", \"Batch D\"]\nbatch_means = [10.02, 9.97, 10.06, 9.94]\nn_per_batch = 45\njitter_width = 0.3\n\nx = Float64[]\ndiameters = Float64[]\ngroup = Int[]\nfor (i, batch_mean) in enumerate(batch_means)\n    readings = batch_mean .+ 0.09 .* randn(n_per_batch)\n    jitter = (rand(n_per_batch) .- 0.5) .* (2 * jitter_width)\n    append!(x, fill(Float64(i), n_per_batch) .+ jitter)\n    append!(diameters, readings)\n    append!(group, fill(i, n_per_batch))\nend\n\ncolors = IMPRINT_PALETTE[group]\n\n# Per-batch summary stats computed from the actual sampled readings\nsample_means = [mean(diameters[group .== i]) for i in 1:length(batches)]\nsample_stds = [std(diameters[group .== i]) for i in 1:length(batches)]\n\n# --- Plot ------------------------------------------------------------------\nfig = Figure(\n    size            = (1600, 900),\n    fontsize        = 14,\n    backgroundcolor = PAGE_BG,\n)\n\nax = Axis(\n    fig[1, 1];\n    title             = \"strip-basic · julia · makie · anyplot.ai\",\n    titlesize         = 20,\n    titlecolor        = INK,\n    xlabel            = \"Production Batch\",\n    ylabel            = \"Bearing Diameter (mm)\",\n    xlabelsize        = 14,\n    ylabelsize        = 14,\n    xlabelcolor       = INK,\n    ylabelcolor       = INK,\n    xticklabelsize    = 12,\n    yticklabelsize    = 12,\n    xticklabelcolor   = INK_SOFT,\n    yticklabelcolor   = INK_SOFT,\n    xtickcolor        = INK_SOFT,\n    ytickcolor        = INK_SOFT,\n    backgroundcolor   = PAGE_BG,\n    topspinevisible   = false,\n    rightspinevisible = false,\n    leftspinecolor    = INK_SOFT,\n    bottomspinecolor  = INK_SOFT,\n    xgridvisible      = false,\n    ygridcolor        = RGBAf(INK.r, INK.g, INK.b, 0.15),\n    xticks            = (1:length(batches), batches),\n)\n\n# Soft ±1 SD spread band per batch, drawn behind the jittered points\nrangebars!(ax, 1:length(batches), sample_means .- sample_stds, sample_means .+ sample_stds;\n    color        = [(c, 0.25) for c in IMPRINT_PALETTE],\n    linewidth    = 10,\n    whiskerwidth = 0,\n)\n\nscatter!(ax, x, diameters;\n    color       = colors,\n    markersize  = 10,\n    alpha       = 0.6,\n    strokewidth = 0.5,\n    strokecolor = PAGE_BG,\n)\n\n# Batch mean reference tick, drawn on top so it reads clearly against the points\nmean_ticks = Point2f[]\nfor (i, m) in enumerate(sample_means)\n    push!(mean_ticks, Point2f(i - jitter_width, m))\n    push!(mean_ticks, Point2f(i + jitter_width, m))\nend\nlinesegments!(ax, mean_ticks; color = INK, linewidth = 3)\n\nxlims!(ax, 0.4, length(batches) + 0.6)\n\n# --- Save --------------------------------------------------------------------\nsave(\"plot-$(THEME).png\", fig; px_per_unit = 2)\n"}