{"spec_id":"step-basic","library":"makie","language":"julia","code":"# anyplot.ai\n# step-basic: Basic Step Plot\n# Library: makie 0.21.9 | Julia 1.11.9\n# Quality: 92/100 | Created: 2026-07-25\n\nusing CairoMakie\nusing Colors\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    colorant\"#AE3030\", colorant\"#2ABCCD\", colorant\"#954477\", colorant\"#99B314\",\n]\n\n# --- Data --------------------------------------------------------------------\n# Open checkout lanes at a retail store — staffing changes at discrete times\n# throughout the day, holding constant until the next adjustment ('post' step).\nhours = [6, 8, 10, 12, 14, 16, 18, 20, 22, 24]\nopen_lanes = [2, 4, 7, 9, 8, 10, 12, 8, 4, 0]\n\n# Expand to 'post'-step coordinates so the area under the stairs can be\n# shaded with band!() — a Makie-distinctive way to give the step curve\n# visual weight instead of a bare line.\nstep_x = Float64[]\nstep_y = Float64[]\nfor i in 1:length(hours)-1\n    push!(step_x, hours[i]); push!(step_y, open_lanes[i])\n    push!(step_x, hours[i+1]); push!(step_y, open_lanes[i])\nend\npush!(step_x, hours[end]); push!(step_y, open_lanes[end])\n\npeak_idx = argmax(open_lanes)\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              = \"Checkout Lanes Open · step-basic · julia · makie · anyplot.ai\",\n    titlesize          = 20,\n    titlecolor         = INK,\n    xlabel             = \"Time of Day\",\n    ylabel             = \"Open Checkout Lanes\",\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             = (hours, [lpad(h, 2, '0') * \":00\" for h in hours]),\n)\nxlims!(ax, 5.5, 24.5)\nylims!(ax, -0.5, 13.5)\n\nband!(ax, step_x, zeros(length(step_x)), step_y;\n    color = (IMPRINT_PALETTE[1], 0.15))\nstairs!(ax, hours, open_lanes; color = IMPRINT_PALETTE[1], linewidth = 3, step = :post)\nscatter!(ax, hours, open_lanes;\n    color = IMPRINT_PALETTE[1], markersize = 16,\n    strokewidth = 1.5, strokecolor = PAGE_BG)\nscatter!(ax, [hours[peak_idx]], [open_lanes[peak_idx]];\n    color = IMPRINT_PALETTE[1], markersize = 24,\n    strokewidth = 2, strokecolor = PAGE_BG)\n\n# --- Save ----------------------------------------------------------------------\nsave(\"plot-$(THEME).png\", fig; px_per_unit = 2)\n"}