{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "<div class=\"contentcontainer med left\" style=\"margin-left: -50px;\">\n",
    "<dl class=\"dl-horizontal\">\n",
    "  <dt>Title</dt> <dd> Surface Element</dd>\n",
    "  <dt>Dependencies</dt> <dd>Matplotlib</dd>\n",
    "  <dt>Backends</dt> <dd><a href='../matplotlib/Surface.ipynb'>Matplotlib</a></dd> <dd><a href='./Surface.ipynb'>Plotly</a></dd>\n",
    "\n",
    "</dl>\n",
    "</div>"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "import numpy as np\n",
    "import holoviews as hv\n",
    "hv.notebook_extension('plotly')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "``Surface`` is used for a set of gridded points whose associated value dimension represents samples from a continuous surface. ``Surface`` is equivalent to an ``Image`` type and supports all the same data formats, including simply NumPy arrays with associated ``bounds`` and other gridded data formats such as xarray.\n",
    "\n",
    "Rendering a large can often be quite expensive, using ``rstride`` and ``cstride`` we can draw a coarser surface. We can also control the ``azimuth``, ``elevation`` and ``distance`` as plot options to control the camera angle:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "%%opts Surface [width=500 height=500] (cmap='plasma')\n",
    "hv.Surface(np.sin(np.linspace(0,100*np.pi*2,10000)).reshape(100,100))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "In addition to a simple surface plots, the matplotlib surface plot also supports other related ``plot_type`` modes including ``'wireframe'`` and ``'contour'`` plots:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "%%opts Surface [width=500 height=500] (cmap='fire')\n",
    "xs = np.arange(-4, 4, 0.25)\n",
    "ys = np.arange(-4, 4, 0.25)\n",
    "X, Y = np.meshgrid(xs, ys)\n",
    "R = np.sqrt(X**2 + Y**2)\n",
    "Z = np.sin(R)\n",
    "surface = hv.Surface((xs, ys, Z))\n",
    "surface"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "For full documentation and the available style and plot options, use ``hv.help(hv.Surface).``"
   ]
  }
 ],
 "metadata": {
  "language_info": {
   "name": "python",
   "pygments_lexer": "ipython3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 1
}
