{"spec_id":"line-basic","library":"makie","language":"julia","code":"# anyplot.ai\n# line-basic: Basic Line Plot\n# Library: makie 0.21.9 | Julia 1.11.9\n# Quality: 92/100 | Created: 2026-08-24\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 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]\nconst BRAND = IMPRINT_PALETTE[1]\n\n# --- Data ---------------------------------------------------------------\n# Hourly temperature readings over a single day (24 hourly samples).\nhours = 0:23\nbase_curve = 14 .+ 9 .* sin.((hours .- 6) .* (pi / 14))\ntemperatures = base_curve .+ randn(length(hours)) .* 0.6\ntemperatures[1:6] .-= 0.4 .* (6 .- (1:6))\n\n# --- Plot -----------------------------------------------------------------\nfig = Figure(\n    size            = (1600, 900),\n    fontsize        = 14,\n    backgroundcolor = PAGE_BG,\n)\n\ntitle_str = \"line-basic · julia · makie · anyplot.ai\"\n\nax = Axis(\n    fig[1, 1];\n    title              = title_str,\n    titlesize          = 20,\n    titlecolor         = INK,\n    xlabel             = \"Hour of Day\",\n    ylabel             = \"Temperature (°C)\",\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    ygridcolor         = RGBAf(INK.r, INK.g, INK.b, 0.15),\n    xgridvisible       = false,\n    xminorgridvisible  = false,\n    yminorgridvisible  = false,\n    xticks             = (0:4:23, string.(0:4:23) .* \":00\"),\n)\n\n# Shade the midday plateau to give the chart a focal point before drawing the line.\nvspan!(ax, 10.5, 15.5; color = RGBAf(BRAND, 0.08f0))\n\nlines!(ax, hours, temperatures; color = BRAND, linewidth = 3.5)\nscatter!(ax, hours, temperatures; color = BRAND, markersize = 10, strokewidth = 0)\n\n# Highlight and label the daily peak.\npeak_idx = argmax(temperatures)\npeak_hour, peak_temp = hours[peak_idx], temperatures[peak_idx]\nscatter!(ax, [peak_hour], [peak_temp]; color = BRAND, markersize = 16, strokewidth = 2, strokecolor = INK)\ntext!(\n    ax, peak_hour, peak_temp;\n    text     = \"Peak: $(round(peak_temp, digits = 1))°C\",\n    align    = (:center, :bottom),\n    offset   = (0, 12),\n    fontsize = 13,\n    color    = INK,\n    space    = :data,\n)\n\nxlims!(ax, -0.5, 23.5)\nylims!(ax, minimum(temperatures) - 2, maximum(temperatures) + 3)\n\n# --- Save -------------------------------------------------------------------\nsave(\"plot-$(THEME).png\", fig; px_per_unit = 2)\n"}