{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "
\n", "
\n", "
Title
Scatter3D Element
\n", "
Dependencies
Matplotlib
\n", "
Backends
Matplotlib
\n", "\n", "
\n", "
" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "import numpy as np\n", "import holoviews as hv\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": [ "%%opts Scatter3D [azimuth=40 elevation=20 color_index=2] (s=50 cmap='fire')\n", "y,x = np.mgrid[-5:5, -5:5] * 0.1\n", "heights = np.sin(x**2+y**2)\n", "hv.Scatter3D(zip(x.flat,y.flat,heights.flat))" ] }, { "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": [ "%%opts Scatter3D [size_index='Size' scaling_factor=5] (marker='^')\n", "hv.Scatter3D(np.random.randn(100,4), vdims='Size') * hv.Scatter3D(np.random.randn(100,4)+2, vdims='Size')" ] }, { "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 }