{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "\n# Filled contours\n\n`.Axes3D.contourf` differs from `.Axes3D.contour` in that it creates filled\ncontours, i.e. a discrete number of colours are used to shade the domain.\n\nThis is like a `.Axes.contourf` plot in 2D except that the shaded region\ncorresponding to the level c is graphed on the plane ``z=c``.\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "import matplotlib.pyplot as plt\n\nfrom matplotlib import cm\nfrom mpl_toolkits.mplot3d import axes3d\n\nax = plt.figure().add_subplot(projection='3d')\nX, Y, Z = axes3d.get_test_data(0.05)\nax.contourf(X, Y, Z, cmap=cm.coolwarm)\n\nplt.show()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ ".. tags::\n plot-type: 3D,\n level: beginner\n\n" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.13.2" } }, "nbformat": 4, "nbformat_minor": 0 }