{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "\n# tricontourf(x, y, z)\nDraw contour regions on an unstructured triangular grid.\n\nSee `~matplotlib.axes.Axes.tricontourf`.\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "import matplotlib.pyplot as plt\nimport numpy as np\n\nplt.style.use('_mpl-gallery-nogrid')\n\n# make data:\nnp.random.seed(1)\nx = np.random.uniform(-3, 3, 256)\ny = np.random.uniform(-3, 3, 256)\nz = (1 - x/2 + x**5 + y**3) * np.exp(-x**2 - y**2)\nlevels = np.linspace(z.min(), z.max(), 7)\n\n# plot:\nfig, ax = plt.subplots()\n\nax.plot(x, y, 'o', markersize=2, color='grey')\nax.tricontourf(x, y, z, levels=levels)\n\nax.set(xlim=(-3, 3), ylim=(-3, 3))\n\nplt.show()" ] } ], "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 }