{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "
\n", "
\n", "
Title
Scatter3D Element
\n", "
Dependencies
Matplotlib
\n", "
Backends
\n", "
Matplotlib
\n", "
Plotly
\n", "
\n", "
" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "import numpy as np\n", "import holoviews as hv\n", "from holoviews import dim, opts\n", "\n", "hv.extension('matplotlib')" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "``Scatter3D`` represents three-dimensional coordinates which may be colormapped or scaled in size according to a value. They are therefore very similar to [``Points``](Points.ipynb) and [``Scatter``](Scatter.ipynb) types but have one additional coordinate dimension. Like other 3D elements the camera angle can be controlled using ``azimuth``, ``elevation`` and ``distance`` plot options:" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "y,x = np.mgrid[-5:5, -5:5] * 0.1\n", "heights = np.sin(x**2+y**2)\n", "hv.Scatter3D((x.flat, y.flat, heights.flat)).opts(\n", " opts.Scatter3D(azimuth=40, elevation=20, color='z', s=50, cmap='fire'))" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Just like all regular 2D elements, ``Scatter3D`` types can be overlaid and will follow the default color cycle: \n" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "(hv.Scatter3D(np.random.randn(100,4), vdims='Size') * hv.Scatter3D(np.random.randn(100,4)+2, vdims='Size')).opts(\n", " opts.Scatter3D(s=(5+dim('Size'))*10, marker='^'))" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "For full documentation and the available style and plot options, use ``hv.help(hv.Scatter3D).``" ] } ], "metadata": { "language_info": { "name": "python", "pygments_lexer": "ipython3" } }, "nbformat": 4, "nbformat_minor": 2 }