{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "\n# plot_trisurf(x, y, z)\n\nSee `~mpl_toolkits.mplot3d.axes3d.Axes3D.plot_trisurf`.\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "import matplotlib.pyplot as plt\nimport numpy as np\n\nfrom matplotlib import cm\n\nplt.style.use('_mpl-gallery')\n\nn_radii = 8\nn_angles = 36\n\n# Make radii and angles spaces\nradii = np.linspace(0.125, 1.0, n_radii)\nangles = np.linspace(0, 2*np.pi, n_angles, endpoint=False)[..., np.newaxis]\n\n# Convert polar (radii, angles) coords to cartesian (x, y) coords.\nx = np.append(0, (radii*np.cos(angles)).flatten())\ny = np.append(0, (radii*np.sin(angles)).flatten())\nz = np.sin(-x*y)\n\n# Plot\nfig, ax = plt.subplots(subplot_kw={'projection': '3d'})\nax.plot_trisurf(x, y, z, vmin=z.min() * 2, cmap=cm.Blues)\n\nax.set(xticklabels=[],\n yticklabels=[],\n zticklabels=[])\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.5" } }, "nbformat": 4, "nbformat_minor": 0 }