{"spec_id":"contour-filled","library":"makie","language":"julia","code":"# anyplot.ai\n# contour-filled: Filled Contour Plot\n# Library: makie 0.21.9 | Julia 1.11.9\n# Quality: 91/100 | Created: 2026-09-04\n\nusing CairoMakie\nusing Colors\n\n# --- Theme tokens -----------------------------------------------------------\nTHEME     = get(ENV, \"ANYPLOT_THEME\", \"light\")\nPAGE_BG   = THEME == \"light\" ? colorant\"#FAF8F1\" : colorant\"#1A1A17\"\nINK       = THEME == \"light\" ? colorant\"#1A1A17\" : colorant\"#F0EFE8\"\nINK_SOFT  = THEME == \"light\" ? colorant\"#4A4A44\" : colorant\"#B8B7B0\"\n_midpoint = THEME == \"light\" ? colorant\"#FAF8F1\" : colorant\"#1A1A17\"\nANYPLOT_DIV = cgrad([colorant\"#AE3030\", _midpoint, colorant\"#4467A3\"])\n\n# --- Data --------------------------------------------------------------------\n# Sea-level pressure anomaly (hPa) over a synthetic regional grid: a high-pressure\n# ridge and a low-pressure trough embedded in gentle background wave activity.\nlon = range(-6.0, 6.0, length=90)\nlat = range(-4.0, 4.0, length=70)\npressure_anomaly = [\n    9.0 * exp(-((x - 2.2)^2 + (y - 1.4)^2) / 6.0) -\n    7.5 * exp(-((x + 2.6)^2 + (y + 1.0)^2) / 4.5) +\n    1.2 * sin(x / 1.6) * cos(y / 1.8)\n    for x in lon, y in lat\n]\n\nn_levels = 14\nz_max = maximum(abs, pressure_anomaly)\nlevels = range(-z_max, z_max, length=n_levels)\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             = \"contour-filled · julia · makie · anyplot.ai\",\n    titlesize         = 20,\n    titlecolor        = INK,\n    xlabel            = \"Longitude offset (°)\",\n    ylabel            = \"Latitude offset (°)\",\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    backgroundcolor   = PAGE_BG,\n    topspinevisible    = false,\n    rightspinevisible  = false,\n    leftspinecolor     = INK_SOFT,\n    bottomspinecolor   = INK_SOFT,\n    xgridvisible       = false,\n    ygridvisible       = false,\n)\n\ncf = contourf!(\n    ax, lon, lat, pressure_anomaly;\n    levels = levels,\n    colormap = ANYPLOT_DIV,\n    extendlow = :auto,\n    extendhigh = :auto,\n)\n\ncontour!(\n    ax, lon, lat, pressure_anomaly;\n    levels = levels,\n    color = (INK, 0.35),\n    linewidth = 1.0,\n)\n\nColorbar(\n    fig[1, 2], cf;\n    label            = \"Pressure anomaly (hPa)\",\n    labelsize        = 14,\n    labelcolor       = INK,\n    ticklabelsize    = 12,\n    ticklabelcolor   = INK_SOFT,\n    tickcolor        = INK_SOFT,\n)\n\ncolsize!(fig.layout, 1, Relative(0.85))\n\n# --- Save ----------------------------------------------------------------------\nsave(\"plot-$(THEME).png\", fig; px_per_unit = 2)\n"}