{"spec_id":"area-mountain-panorama","library":"makie","language":"julia","code":"# anyplot.ai\n# area-mountain-panorama: Mountain Panorama Profile with Labeled Peaks\n# Library: makie 0.24.16 | Julia 1.13.3\n# Quality: 85/100 | Updated: 2026-11-08\n\nusing CairoMakie\nusing Colors\nusing Random\n\nRandom.seed!(42)\n\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 SKY_BG   = THEME == \"light\" ? colorant\"#B8D8EF\" : colorant\"#0D1825\"\n# Dark-theme silhouette lifted to #5A6E8C: ~3.4:1 against the night sky\nconst MTN_FILL = THEME == \"light\" ? colorant\"#262623\" : colorant\"#5A6E8C\"\nconst BRAND    = colorant\"#009E73\"  # Imprint palette position 1\n\n# Peaks: (position, elevation_m, name, left_flank, right_flank)\n# Order is the real clockwise sweep seen from Gornergrat (SE → S → W → N → E);\n# horizontal spacing is schematic, compressing the empty stretches of the 360° view\nconst PEAKS = [\n    (  4.0, 4634.0, \"Monte Rosa\",      9.0, 10.0),\n    ( 16.0, 4527.0, \"Liskamm\",         8.0,  8.0),\n    ( 26.0, 4223.0, \"Castor\",          6.0,  5.0),\n    ( 34.0, 4092.0, \"Pollux\",          5.0,  7.0),\n    ( 46.0, 4164.0, \"Breithorn\",       8.0,  7.0),\n    ( 72.0, 4478.0, \"Matterhorn\",      4.0,  5.5),\n    ( 98.0, 4358.0, \"Dent Blanche\",   10.0,  7.0),\n    (108.0, 4063.0, \"Ober Gabelhorn\",  6.0,  6.0),\n    (120.0, 4221.0, \"Zinalrothorn\",    7.0,  6.0),\n    (132.0, 4506.0, \"Weisshorn\",       9.0,  8.0),\n    (150.0, 4545.0, \"Dom\",             7.0,  4.0),\n    (155.0, 4491.0, \"Täschhorn\",       4.0,  6.0),\n    (164.0, 4206.0, \"Alphubel\",        6.0,  6.0),\n    (172.0, 4027.0, \"Allalinhorn\",     5.0,  5.0),\n    (181.0, 4199.0, \"Rimpfischhorn\",   6.0,  5.0),\n    (190.0, 4190.0, \"Strahlhorn\",      5.0,  8.0),\n]\nconst ANCHOR = \"Matterhorn\"\n\n# Unnamed sub-peaks and cols; the anchor horn is the steepest, narrowest summit,\n# isolated by deep notches on both sides, with a Hörnli shoulder on its right flank\nconst SUBPEAKS = [\n    ( 53.0, 3880.0, 4.0, 5.0),\n    ( 60.0, 3350.0, 4.0, 5.0),\n    ( 75.0, 3800.0, 1.0, 3.0),\n    ( 84.0, 3560.0, 5.0, 5.0),\n    ( 90.0, 3720.0, 5.0, 6.0),\n    (141.0, 3700.0, 5.0, 5.0),\n]\n\n# Staggered label heights — three levels, set so no leader line crosses a neighbor's label\nconst LVL_A, LVL_B, LVL_C = 4790.0, 5010.0, 5230.0\nconst LABEL_YS = [\n    LVL_B,  # Monte Rosa\n    LVL_C,  # Liskamm\n    LVL_A,  # Castor\n    LVL_B,  # Pollux\n    LVL_A,  # Breithorn\n    LVL_C,  # Matterhorn\n    LVL_B,  # Dent Blanche\n    LVL_A,  # Ober Gabelhorn\n    LVL_C,  # Zinalrothorn\n    LVL_A,  # Weisshorn\n    LVL_B,  # Dom\n    LVL_C,  # Täschhorn\n    LVL_A,  # Alphubel\n    LVL_B,  # Allalinhorn\n    LVL_C,  # Rimpfischhorn\n    LVL_A,  # Strahlhorn\n]\n\nconst BASELINE = 2780.0\nconst N        = 1600\n\nangles = collect(LinRange(-6.0, 197.0, N))\n\n# Ridgeline = max over asymmetric tent functions (sharp apex, linear flanks)\ntents = vcat([(pa, pe, lw, rw) for (pa, pe, _, lw, rw) in PEAKS], SUBPEAKS)\nridgeline = [maximum(\n                 a - pa <= -lw || a - pa >= rw ? BASELINE :\n                 a < pa ? BASELINE + (pe - BASELINE) * (a - pa + lw) / lw :\n                          pe - (pe - BASELINE) * (a - pa) / rw\n                 for (pa, pe, lw, rw) in tents)\n             for a in angles]\n\n# Irregular rocky jaggedness, damped near summits to preserve sharp apexes\njitter = 30.0 .* (rand(N) .- 0.5)\nfor (pa, pe, pname, lw, rw) in PEAKS\n    for i in eachindex(angles)\n        d = abs(angles[i] - pa)\n        d < 3.0 && (jitter[i] *= d / 3.0)\n    end\nend\nridgeline .+= jitter\n\n# Restore exact summit elevations after jitter\nfor (pa, pe, pname, lw, rw) in PEAKS\n    ridgeline[argmin(abs.(angles .- pa))] = pe\nend\nridgeline = max.(ridgeline, BASELINE)\n\n# Silhouette polygon: ridgeline + closed base\nsil_pts = [Point2f(a, r) for (a, r) in zip(angles, ridgeline)]\npush!(sil_pts, Point2f(Float32(angles[end]), 2400.0f0))\npush!(sil_pts, Point2f(Float32(angles[1]),   2400.0f0))\n\n# Composite Makie theme — consolidates all chrome into one reusable Theme object\nconst ANYPLOT_MAKIE_THEME = Theme(\n    fontsize        = 14,\n    backgroundcolor = PAGE_BG,\n    Axis = (\n        backgroundcolor   = SKY_BG,\n        titlecolor        = INK,\n        xlabelcolor       = INK,\n        ylabelcolor       = INK,\n        xticklabelcolor   = INK_SOFT,\n        yticklabelcolor   = INK_SOFT,\n        xtickcolor        = INK_SOFT,\n        ytickcolor        = INK_SOFT,\n        leftspinecolor    = INK_SOFT,\n        bottomspinecolor  = INK_SOFT,\n        topspinevisible   = false,\n        rightspinevisible = false,\n        xgridvisible      = false,\n        ygridvisible      = false,\n    ),\n)\n\nwith_theme(ANYPLOT_MAKIE_THEME) do\n    title_str = \"Wallis Peaks Panorama · area-mountain-panorama · julia · makie · anyplot.ai\"\n    title_sz  = round(Int, 20 * min(1.0, 67 / length(title_str)))\n\n    fig = Figure(size = (1600, 900), backgroundcolor = PAGE_BG)\n\n    ax = Axis(\n        fig[2, 1];\n        title          = title_str,\n        titlesize      = title_sz,\n        xlabel         = \"Clockwise sweep from Gornergrat:  SE  →  S  →  W  →  N  →  E\",\n        ylabel         = \"Elevation (m)\",\n        xlabelsize     = 14,\n        ylabelsize     = 14,\n        yticklabelsize = 14,\n        xticksvisible      = false,\n        xticklabelsvisible = false,\n        yticks         = 2500:500:5000,\n    )\n\n    # Makie layout: subtitle Label sits above the axis panel in row 1\n    Label(fig[1, 1], \"Swiss Alps · Wallis · 360° view from Gornergrat (3100 m) · schematic horizontal spacing\";\n          fontsize = 13, color = INK_SOFT, tellwidth = false)\n    rowgap!(fig.layout, 1, 2)\n\n    xlims!(ax, -6.0, 197.0)\n    ylims!(ax, 2450.0, 5450.0)\n\n    # Mountain silhouette fill\n    poly!(ax, sil_pts; color = MTN_FILL, strokewidth = 0)\n\n    # Peak markers and staggered labels with leader lines; the anchor summit gets\n    # a larger marker, a brand-green leader and a bold, larger label\n    for (i, (pa, pe, name, lw, rw)) in enumerate(PEAKS)\n        is_anchor = name == ANCHOR\n        lh = LABEL_YS[i]\n        lines!(ax, [pa, pa], [pe + 40.0, lh - 40.0];\n               color = is_anchor ? BRAND : INK_SOFT, linewidth = is_anchor ? 2.0 : 1.0)\n        scatter!(ax, [pa], [pe]; color = BRAND, markersize = is_anchor ? 18 : 9,\n                 strokewidth = is_anchor ? 2.0 : 0.0, strokecolor = PAGE_BG)\n        text!(ax, pa, lh; text = \"$(name)\\n$(Int(pe)) m\", color = INK,\n              fontsize = is_anchor ? 18 : 15, font = is_anchor ? :bold : :regular,\n              align = (:center, :bottom))\n    end\n\n    save(\"plot-$(THEME).png\", fig; px_per_unit = 2)\nend\n"}