{"spec_id":"histogram-basic","library":"makie","language":"julia","code":"# anyplot.ai\n# histogram-basic: Basic Histogram\n# Library: makie 0.22.10 | Julia 1.11.9\n# Quality: 89/100 | Created: 2026-05-28\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 BRAND   = colorant\"#009E73\"\n\n# Data — customer age distribution (bimodal: young adults + mid-career segment)\nages_young  = randn(200) .* 5 .+ 28\nages_mid    = randn(150) .* 8 .+ 55\nages        = vcat(ages_young, ages_mid)\nages        = clamp.(ages, 18, 75)\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             = \"histogram-basic · julia · makie · anyplot.ai\",\n    titlesize         = 22,\n    titlecolor        = INK,\n    xlabel            = \"Customer Age\",\n    ylabel            = \"Count\",\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.15f0),\n    yminorgridvisible = false,\n    xminorgridvisible = false,\n)\n\nhist!(ax, ages;\n    bins        = 28,\n    color       = BRAND,\n    strokecolor = PAGE_BG,\n    strokewidth = 1.5,\n)\n\n# Bimodal valley reference line separating the two customer segments\nvlines!(ax, [42.0]; color = INK_SOFT, linestyle = :dash, linewidth = 1.5)\n\n# Segment annotations above each distribution peak\ntext!(ax, 27.0, 37.0; text = \"Young Adult\\nSegment\", color = INK,\n    fontsize = 12, align = (:center, :bottom))\ntext!(ax, 55.0, 19.0; text = \"Mid-Career\\nSegment\", color = INK,\n    fontsize = 12, align = (:center, :bottom))\n\nylims!(ax, 0, 52)\n\n# Save\nsave(\"plot-$(THEME).png\", fig; px_per_unit = 2)\n"}