{"spec_id":"line-styled","library":"makie","language":"julia","code":"# anyplot.ai\n# line-styled: Styled Line Plot\n# Library: makie 0.21.9 | Julia 1.11.9\n# Quality: 89/100 | Created: 2026-09-05\n\nusing CairoMakie\nusing Colors\nusing Random\n\nRandom.seed!(42)\n\n# --- Theme tokens (see prompts/default-style-guide.md \"Theme-adaptive Chrome\") ---\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\"\n\n# Imprint palette (position 1-4) — theme-independent\nconst IMPRINT_PALETTE = [\n    colorant\"#009E73\",  # 1 — brand green\n    colorant\"#C475FD\",  # 2 — lavender\n    colorant\"#4467A3\",  # 3 — blue\n    colorant\"#BD8233\",  # 4 — ochre\n]\n\n# --- Data: hourly latency percentiles over a week of web traffic ------------\nhours = 0:167  # 7 days x 24h\ndaily_cycle = sin.(2π .* mod.(hours, 24) ./ 24 .- π / 2)  # peaks around midday\n\np50 = 80.0 .+ 15.0 .* daily_cycle .+ randn(length(hours)) .* 4.0\np90 = 180.0 .+ 35.0 .* daily_cycle .+ randn(length(hours)) .* 8.0\np99 = 320.0 .+ 60.0 .* daily_cycle .+ randn(length(hours)) .* 15.0\np999 = 480.0 .+ 90.0 .* daily_cycle .+ randn(length(hours)) .* 25.0\n\n# --- Plot ---------------------------------------------------------------\nfig = Figure(\n    resolution      = (1600, 900),\n    fontsize        = 14,\n    backgroundcolor = PAGE_BG,\n)\n\nax = Axis(\n    fig[1, 1];\n    title              = \"API Latency Percentiles · line-styled · julia · makie · anyplot.ai\",\n    titlesize          = 20,\n    titlecolor         = INK,\n    subtitle           = \"p99.9 tail latency runs ~6× the p50 baseline\",\n    subtitlesize       = 15,\n    subtitlecolor      = INK_SOFT,\n    xlabel             = \"Time (hours)\",\n    ylabel             = \"Response Time (ms)\",\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)\n\n# Distinctive Makie touch: shade the p99-p99.9 tail spread as a translucent\n# band so the widening gap between the two most extreme percentiles reads at\n# a glance, without darkening the whole canvas.\nband!(ax, hours, p99, p999; color = (IMPRINT_PALETTE[4], 0.12))\n\nlines!(ax, hours, p50; color = IMPRINT_PALETTE[1], linestyle = :solid, linewidth = 2.75, label = \"p50\")\nlines!(ax, hours, p90; color = IMPRINT_PALETTE[2], linestyle = :dash, linewidth = 2.75, label = \"p90\")\nlines!(ax, hours, p99; color = IMPRINT_PALETTE[3], linestyle = :dot, linewidth = 2.75, label = \"p99\")\nlines!(ax, hours, p999; color = IMPRINT_PALETTE[4], linestyle = :dashdot, linewidth = 2.75, label = \"p99.9\")\n\naxislegend(ax; position = :rb, labelcolor = INK_SOFT, framevisible = false)\n\n# --- Save -----------------------------------------------------------------\nsave(\"plot-$(THEME).png\", fig; px_per_unit = 2)\n"}