{"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.21.9 | Julia 1.11.9\n# Quality: 80/100 | Created: 2026-06-30\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-mode luminance bumped to #324060 so silhouette reads clearly against navy sky\nconst MTN_FILL = THEME == \"light\" ? colorant\"#262623\" : colorant\"#324060\"\nconst BRAND    = colorant\"#009E73\"\n\n# Peaks: (angle_deg, elevation_m, name, left_slope_deg, right_slope_deg)\n# Panorama from Gornergrat-area vantage, sweeping west to east\nconst PEAKS = [\n    ( 10.0, 4506.0, \"Weisshorn\",      15.0, 10.0),\n    ( 22.0, 4221.0, \"Zinalrothorn\",    8.0,  7.0),\n    ( 33.0, 4063.0, \"Ober Gabelhorn\",  7.0,  9.0),\n    ( 52.0, 4358.0, \"Dent Blanche\",   13.0,  9.0),\n    ( 88.0, 4478.0, \"Matterhorn\",      8.0,  6.5),\n    (103.0, 4491.0, \"Täschhorn\",       8.0,  6.0),\n    (110.0, 4545.0, \"Dom\",             6.0,  8.0),\n    (122.0, 4206.0, \"Alphubel\",        8.0,  8.0),\n    (133.0, 4027.0, \"Allalinhorn\",     7.0,  6.0),\n    (142.0, 4199.0, \"Rimpfischhorn\",   6.0,  7.0),\n    (151.0, 4190.0, \"Strahlhorn\",      7.0,  7.0),\n    (158.0, 4223.0, \"Castor\",          5.0,  4.5),\n    (163.0, 4092.0, \"Pollux\",          4.0,  4.5),\n    (170.0, 4527.0, \"Liskamm\",         6.0,  5.5),\n    (178.0, 4634.0, \"Monte Rosa\",      8.0, 10.0),\n]\n\n# Staggered label heights — alternating levels prevent overlap across 15 dense peaks\nconst LABEL_YS = [\n    5100.0,  # Weisshorn\n    4870.0,  # Zinalrothorn\n    5100.0,  # Ober Gabelhorn\n    4870.0,  # Dent Blanche\n    5250.0,  # Matterhorn (focal point — highest label)\n    4870.0,  # Täschhorn\n    5100.0,  # Dom\n    4870.0,  # Alphubel\n    5100.0,  # Allalinhorn\n    4870.0,  # Rimpfischhorn\n    5100.0,  # Strahlhorn\n    4870.0,  # Castor\n    4640.0,  # Pollux (close to Castor — lowered further)\n    5100.0,  # Liskamm\n    4870.0,  # Monte Rosa\n]\n\nconst BASELINE = 2780.0\nconst N        = 1600\n\nangles = collect(LinRange(-5.0, 185.0, N))\n\n# Asymmetric tent function: sharp triangular peak, linear flanks\nfunction tent(ang, pa, pe, lw, rw)\n    dx = ang - pa\n    (dx <= -lw || dx >= rw) && return BASELINE\n    return dx < 0 ? BASELINE + (pe - BASELINE) * (dx + lw) / lw :\n                    pe  - (pe  - BASELINE) * dx / rw\nend\n\n# Ridgeline = max of all tent functions\nridgeline = [maximum(tent(a, pa, pe, lw, rw) for (pa, pe, pname, lw, rw) in PEAKS)\n             for a in angles]\n\n# Midpoint-displacement 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  = max(11, round(Int, 20 * 67 / length(title_str)))\n\n    fig = Figure(size = (1600, 900), backgroundcolor = PAGE_BG)\n\n    # Makie layout: subtitle Label sits above the axis panel in row 0\n    Label(fig[0, 1], \"Swiss Alps · Wallis Region · Gornergrat Vantage · 3100 m\";\n          fontsize = 11, color = INK_SOFT, tellwidth = false)\n    rowgap!(fig.layout, 1, 2)\n\n    ax = Axis(\n        fig[1, 1];\n        title          = title_str,\n        titlesize      = title_sz,\n        xlabel         = \"Bearing (°)\",\n        ylabel         = \"Elevation (m)\",\n        xlabelsize     = 13,\n        ylabelsize     = 13,\n        xticklabelsize = 11,\n        yticklabelsize = 11,\n        xticks         = 0:30:180,\n        yticks         = 2500:500:5000,\n    )\n\n    xlims!(ax, -5.0, 185.0)\n    ylims!(ax, 2450.0, 5350.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\n    for (i, (pa, pe, name, lw, rw)) in enumerate(PEAKS)\n        is_matterhorn = (name == \"Matterhorn\")\n        ms = is_matterhorn ? 14 : 8\n        sw = is_matterhorn ? 1.5 : 0.0\n        scatter!(ax, [pa], [pe]; color = BRAND, markersize = ms,\n                 strokewidth = sw, strokecolor = PAGE_BG)\n\n        lh = LABEL_YS[i]\n        lines!(ax, [pa, pa], [pe + 30.0, lh - 150.0]; color = INK_SOFT, linewidth = 1.0)\n        text!(ax, pa, lh; text = \"$(name)\\n$(Int(pe)) m\",\n              color = INK, fontsize = 11, align = (:center, :bottom))\n    end\n\n    save(\"plot-$(THEME).png\", fig; px_per_unit = 2)\nend\n"}