{"spec_id":"contour-filled","library":"seaborn","language":"python","code":"\"\"\" anyplot.ai\ncontour-filled: Filled Contour Plot\nLibrary: seaborn 0.13.2 | Python 3.13.13\nQuality: 88/100 | Updated: 2026-05-15\n\"\"\"\n\nimport os\n\nimport matplotlib.pyplot as plt\nimport numpy as np\nimport seaborn as sns\n\n\n# Theme tokens\nTHEME = os.getenv(\"ANYPLOT_THEME\", \"light\")\nPAGE_BG = \"#FAF8F1\" if THEME == \"light\" else \"#1A1A17\"\nELEVATED_BG = \"#FFFDF6\" if THEME == \"light\" else \"#242420\"\nINK = \"#1A1A17\" if THEME == \"light\" else \"#F0EFE8\"\nINK_SOFT = \"#4A4A44\" if THEME == \"light\" else \"#B8B7B0\"\n\n# Configure seaborn theme\nsns.set_theme(\n    style=\"ticks\",\n    rc={\n        \"figure.facecolor\": PAGE_BG,\n        \"axes.facecolor\": PAGE_BG,\n        \"axes.edgecolor\": INK_SOFT,\n        \"axes.labelcolor\": INK,\n        \"text.color\": INK,\n        \"xtick.color\": INK_SOFT,\n        \"ytick.color\": INK_SOFT,\n        \"grid.color\": INK,\n        \"grid.alpha\": 0.10,\n        \"legend.facecolor\": ELEVATED_BG,\n        \"legend.edgecolor\": INK_SOFT,\n    },\n)\n\n# Data: Temperature field across geographic region (application context)\nnp.random.seed(42)\nlongitude = np.linspace(-180, 180, 80)\nlatitude = np.linspace(-90, 90, 80)\nLon, Lat = np.meshgrid(longitude, latitude)\n\n# Create realistic temperature field with peaks (hot regions) and valleys (cold regions)\ntemp1 = 25 * np.exp(-((Lon - 60) ** 2 + (Lat - 30) ** 2) / 1200)\ntemp2 = 20 * np.exp(-((Lon + 80) ** 2 + (Lat + 40) ** 2) / 1500)\ntemp3 = -15 * np.exp(-((Lon - 40) ** 2 + (Lat - 60) ** 2) / 800)\nTemperature = temp1 + temp2 + temp3 + 10\n\n# Create figure and plot\nfig, ax = plt.subplots(figsize=(16, 9), facecolor=PAGE_BG)\n\n# Create filled contour with viridis colormap\npalette = sns.color_palette(\"viridis\", as_cmap=True)\nlevels = np.linspace(Temperature.min(), Temperature.max(), 15)\ncontourf = ax.contourf(Lon, Lat, Temperature, levels=levels, cmap=palette)\n\n# Overlay contour lines for level identification\ncontour_lines = ax.contour(Lon, Lat, Temperature, levels=levels, colors=INK_SOFT, linewidths=0.5, alpha=0.3)\n\n# Add colorbar\ncbar = fig.colorbar(contourf, ax=ax, shrink=0.85, pad=0.02)\ncbar.set_label(\"Temperature (°C)\", fontsize=20, color=INK)\ncbar.ax.tick_params(labelsize=16, colors=INK_SOFT)\n\n# Styling\nax.set_xlabel(\"Longitude (°E)\", fontsize=20, color=INK)\nax.set_ylabel(\"Latitude (°N)\", fontsize=20, color=INK)\nax.set_title(\"contour-filled · seaborn · anyplot.ai\", fontsize=24, color=INK)\nax.tick_params(axis=\"both\", labelsize=16, colors=INK_SOFT)\nax.set_aspect(\"equal\")\n\n# Remove grid\nax.grid(False)\n\n# Style colorbar ticks\nfor label in cbar.ax.get_yticklabels():\n    label.set_color(INK_SOFT)\n\nplt.tight_layout()\nplt.savefig(f\"plot-{THEME}.png\", dpi=300, bbox_inches=\"tight\", facecolor=PAGE_BG)\n"}