{
  "cells": [
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "\n# 3D plotting vignette\n\nDemo 3D plotting with matplotlib and decorate the figure.\n"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "collapsed": false
      },
      "outputs": [],
      "source": [
        "import numpy as np\nimport matplotlib.pyplot as plt\nfrom mpl_toolkits.mplot3d import Axes3D\n\nx = np.arange(-4, 4, 0.25)\ny = np.arange(-4, 4, 0.25)\nX, Y = np.meshgrid(x, y)\nR = np.sqrt(X**2 + Y**2)\nZ = np.sin(R)\n\nfig = plt.figure()\nax: Axes3D = fig.add_subplot(111, projection=\"3d\")\n\nax.plot_surface(X, Y, Z, rstride=1, cstride=1, cmap=\"hot\")\nax.contourf(X, Y, Z, zdir=\"z\", offset=-2, cmap=\"hot\")\n\nax.set_zlim(-2, 2)\nplt.xticks([])\nplt.yticks([])\nax.set_zticks([])\n\nax.text2D(\n    0.05,\n    0.93,\n    \" 3D plots             \\n\",\n    horizontalalignment=\"left\",\n    verticalalignment=\"top\",\n    size=\"xx-large\",\n    bbox={\"facecolor\": \"white\", \"alpha\": 1.0},\n    transform=plt.gca().transAxes,\n)\n\nax.text2D(\n    0.05,\n    0.87,\n    \" Plot 2D or 3D data\",\n    horizontalalignment=\"left\",\n    verticalalignment=\"top\",\n    size=\"large\",\n    transform=plt.gca().transAxes,\n)\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.12.11"
    }
  },
  "nbformat": 4,
  "nbformat_minor": 0
}