{"spec_id":"pyramid-basic","library":"makie","language":"julia","code":"# anyplot.ai\n# pyramid-basic: Basic Pyramid Chart\n# Library: makie 0.21.9 | Julia 1.11.9\n# Quality: 90/100 | Created: 2026-09-05\n\nusing CairoMakie\nusing Colors\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\"\nconst GRID     = RGBAf(INK.r, INK.g, INK.b, 0.15)\n\n# Imprint palette — Agree is positive sentiment (brand green, position 1),\n# Disagree is negative sentiment (matte red, semantic anchor)\nconst AGREE_COLOR    = colorant\"#009E73\"\nconst DISAGREE_COLOR = colorant\"#AE3030\"\n\n# Data — employee survey on workplace policies, sorted most- to least-agreed\npolicies = [\n    \"Flexible Hours\",\n    \"Remote Work Days\",\n    \"Four-Day Workweek\",\n    \"Unlimited PTO Policy\",\n    \"Open Floor Plan\",\n    \"Annual Performance Reviews\",\n    \"Mandatory Team Retreats\",\n    \"Return-to-Office Mandate\",\n    \"Mandatory Overtime\",\n]\nagree_pct    = [82, 74, 68, 61, 39, 33, 28, 22, 12]\ndisagree_pct = [8, 15, 20, 24, 47, 52, 58, 68, 79]\npositions = 1:length(policies)\n\n# Plot\ntitle_str = \"Employee Policy Survey · pyramid-basic · julia · makie · anyplot.ai\"\ntitle_fontsize = round(Int, 20 * min(1.0, 67 / length(title_str)))\n\nfig = Figure(\n    size            = (1600, 900),\n    fontsize        = 14,\n    backgroundcolor = PAGE_BG,\n)\n\nax = Axis(\n    fig[1, 1];\n    title             = title_str,\n    titlesize         = title_fontsize,\n    titlecolor        = INK,\n    xlabel            = \"Respondents\",\n    xlabelcolor       = INK,\n    xlabelsize        = 14,\n    xticklabelcolor   = INK_SOFT,\n    xticklabelsize    = 12,\n    xticks            = (-80:20:80, [string(abs(v)) * \"%\" for v in -80:20:80]),\n    yticks            = (positions, policies),\n    yticklabelcolor   = INK_SOFT,\n    yticklabelsize    = 12,\n    yreversed         = true,\n    backgroundcolor   = PAGE_BG,\n    topspinevisible    = false,\n    rightspinevisible  = false,\n    leftspinevisible   = false,\n    bottomspinecolor   = INK_SOFT,\n    xgridcolor         = GRID,\n    ygridvisible       = false,\n)\nxlims!(ax, -95, 95)\n\nbarplot!(ax, positions, -disagree_pct; direction = :x, color = DISAGREE_COLOR, label = \"Disagree\")\nbarplot!(ax, positions, agree_pct; direction = :x, color = AGREE_COLOR, label = \"Agree\")\nvlines!(ax, 0; color = INK_SOFT, linewidth = 1)\n\nLegend(fig[1, 2], ax; framevisible = false, labelcolor = INK)\ncolsize!(fig.layout, 2, Auto(0.18))\n\n# Save\nsave(\"plot-$(THEME).png\", fig; px_per_unit = 2)\n"}