{"spec_id":"line-confidence","library":"makie","language":"julia","code":"# anyplot.ai\n# line-confidence: Line Plot with Confidence Interval\n# Library: makie 0.21.9 | Julia 1.11.9\n# Quality: 86/100 | Created: 2026-09-05\n\nusing CairoMakie\nusing Colors\nusing Random\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 ELEVATED_BG = THEME == \"light\" ? colorant\"#FFFDF6\" : colorant\"#242420\"\nconst INK         = THEME == \"light\" ? colorant\"#1A1A17\" : colorant\"#F0EFE8\"\nconst INK_SOFT    = THEME == \"light\" ? colorant\"#4A4A44\" : colorant\"#B8B7B0\"\nconst BRAND       = colorant\"#009E73\"  # Imprint palette position 1 — ALWAYS first series\n\n# --- Data ---------------------------------------------------------------\n# Daily-active-users forecast after a product launch: a saturating growth\n# curve (point estimate) with a prediction interval that widens further out\n# on the forecast horizon, as is typical for time-series forecasts.\ndays_since_launch = collect(1:60)\nnoise = randn(length(days_since_launch)) .* 15\npredicted_dau = @. 5000 + 4200 * (1 - exp(-days_since_launch / 18)) +\n                   40 * sin(days_since_launch / 6) + noise\ninterval_margin = @. 60 + 5.5 * days_since_launch\nlower_bound = predicted_dau .- interval_margin\nupper_bound = predicted_dau .+ interval_margin\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              = \"line-confidence · julia · makie · anyplot.ai\",\n    titlesize          = 20,\n    titlecolor         = INK,\n    xlabel             = \"Days Since Launch\",\n    ylabel             = \"Daily Active Users\",\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    xminorgridvisible  = false,\n    yminorgridvisible  = false,\n)\n\nband_plot = band!(\n    ax, days_since_launch, lower_bound, upper_bound;\n    color = RGBAf(BRAND.r, BRAND.g, BRAND.b, 0.25),\n)\nline_plot = lines!(\n    ax, days_since_launch, predicted_dau;\n    color     = BRAND,\n    linewidth = 3,\n)\n\naxislegend(\n    ax,\n    [line_plot, band_plot],\n    [\"Predicted DAU\", \"95% prediction interval\"];\n    position        = :lt,\n    backgroundcolor = ELEVATED_BG,\n    framecolor      = INK_SOFT,\n    labelcolor      = INK,\n)\n\n# --- Save -------------------------------------------------------------------\nsave(\"plot-$(THEME).png\", fig; px_per_unit = 2)\n"}