File: C:/Users/fred/anaconda3/Lib/site-packages/holoviews/examples/gallery/demos/plotly/surface_3d.ipynb
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# 3D surface (color map)\n",
"\n",
"URL: http://matplotlib.org/examples/mplot3d/surface3d_demo.html\n",
"\n",
"Most examples work across multiple plotting backends, this example is also available for:\n",
"\n",
"* [Matplotlib - 3d surface](../matplotlib/surface_3d.ipynb)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## HoloViews"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"import numpy as np\n",
"import holoviews as hv\n",
"hv.extension('plotly')"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Define data"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# Make data.\n",
"X = np.arange(-5, 5, 0.25)\n",
"Y = np.arange(-5, 5, 0.25)\n",
"X, Y = np.meshgrid(X, Y)\n",
"R = np.sqrt(X**2 + Y**2)\n",
"Z = np.sin(R)\n",
"\n",
"surface = hv.Surface(Z, bounds=(-5, -5, 5, 5))"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Plot"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"surface.opts(colorbar=True, width=500, height=500)"
]
}
],
"metadata": {
"language_info": {
"name": "python",
"pygments_lexer": "ipython3"
}
},
"nbformat": 4,
"nbformat_minor": 2
}