{"spec_id":"surface-basic","library":"makie","language":"julia","code":"# anyplot.ai\n# surface-basic: Basic 3D Surface Plot\n# Library: makie 0.21.9 | Julia 1.11.9\n# Quality: 86/100 | Created: 2026-09-10\n\nusing CairoMakie\nusing Colors\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\"\n# Nudged slightly off the exact page-background color (rather than the plain\n# #FAF8F1/#1A1A17 tokens) so near-zero surface regions stay visually distinct\n# from the Axis3 panel walls, which are also filled with PAGE_BG.\nconst MIDPOINT = THEME == \"light\" ? colorant\"#EDE8DA\" : colorant\"#2B2B26\"\n\n# Imprint diverging colormap — the wave field oscillates above and below the\n# z=0 plane, a signed deviation rather than a single-polarity magnitude\n# (default-style-guide.md \"Continuous Data\").\nconst IMPRINT_DIV = cgrad([colorant\"#AE3030\", MIDPOINT, colorant\"#4467A3\"])\n\n# --- Data ---------------------------------------------------------------\n# Damped standing-wave field z = sin(x)*cos(y)*exp(-r^2 * decay), a classic\n# two-variable function surface (default-style-guide \"Applications\").\n# Deterministic, no RNG needed.\nx = range(-6, 6, length=45)\ny = range(-6, 6, length=45)\nz = [sin(xi) * cos(yi) * exp(-0.05 * (xi^2 + yi^2)) for xi in x, yi in y]\n\n# --- Plot -----------------------------------------------------------------\ntitle_str = \"surface-basic · julia · makie · anyplot.ai\"\n\nfig = Figure(\n    resolution      = (1600, 900),\n    fontsize        = 14,\n    backgroundcolor = PAGE_BG,\n)\n\nax = Axis3(\n    fig[1, 1];\n    title              = title_str,\n    titlesize          = 20,\n    titlecolor         = INK,\n    xlabel             = \"x\",\n    ylabel             = \"y\",\n    zlabel             = \"Amplitude (z)\",\n    xlabelsize         = 14,\n    ylabelsize         = 14,\n    zlabelsize         = 14,\n    xlabelcolor        = INK,\n    ylabelcolor        = INK,\n    zlabelcolor        = INK,\n    xticklabelsize     = 12,\n    yticklabelsize     = 12,\n    zticklabelsize     = 12,\n    xticklabelcolor    = INK_SOFT,\n    yticklabelcolor    = INK_SOFT,\n    zticklabelcolor    = INK_SOFT,\n    xtickcolor         = INK_SOFT,\n    ytickcolor         = INK_SOFT,\n    ztickcolor         = INK_SOFT,\n    xspinecolor_1      = INK_SOFT,\n    yspinecolor_1      = INK_SOFT,\n    zspinecolor_1      = INK_SOFT,\n    xspinecolor_2      = INK_SOFT,\n    yspinecolor_2      = INK_SOFT,\n    zspinecolor_2      = INK_SOFT,\n    xspinecolor_3      = INK_SOFT,\n    yspinecolor_3      = INK_SOFT,\n    zspinecolor_3      = INK_SOFT,\n    xgridcolor         = RGBAf(INK.r, INK.g, INK.b, 0.15),\n    ygridcolor         = RGBAf(INK.r, INK.g, INK.b, 0.15),\n    zgridcolor         = RGBAf(INK.r, INK.g, INK.b, 0.15),\n    xypanelcolor       = PAGE_BG,\n    xzpanelcolor       = PAGE_BG,\n    yzpanelcolor       = PAGE_BG,\n    backgroundcolor    = PAGE_BG,\n    aspect             = (1, 1, 0.6),\n    azimuth            = 1.25 * pi,\n    elevation          = 0.18 * pi,\n    protrusions        = (40, 40, 10, 40),\n    viewmode           = :stretch,\n)\n\nsurf = surface!(ax, x, y, z; colormap = IMPRINT_DIV, colorrange = (-1, 1))\n\nColorbar(\n    fig[1, 2], surf;\n    label = \"Amplitude (z)\", width = 22,\n    labelcolor = INK, ticklabelcolor = INK_SOFT, tickcolor = INK_SOFT,\n    leftspinecolor = INK_SOFT, rightspinecolor = INK_SOFT,\n    topspinecolor = INK_SOFT, bottomspinecolor = INK_SOFT,\n)\n\ncolsize!(fig.layout, 1, Relative(0.88))\n\n# --- Save -------------------------------------------------------------------\nsave(\"plot-$(THEME).png\", fig; px_per_unit = 2)\n"}