# ---
# jupyter:
#   jupytext:
#     text_representation:
#       extension: .py
#       format_name: light
#       format_version: '1.5'
#       jupytext_version: 1.14.4
# ---

# <div class="contentcontainer med left" style="margin-left: -50px;">
# <dl class="dl-horizontal">
#   <dt>Title</dt> <dd> Scatter3D Element</dd>
#   <dt>Dependencies</dt> <dd>Matplotlib</dd>
#   <dt>Backends</dt> <dd><a href='../matplotlib/Image.ipynb'>Matplotlib</a></dd>
#
# </dl>
# </div>

import numpy as np
import holoviews as hv
hv.extension('matplotlib')

# ``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:

# %%opts Scatter3D [azimuth=40 elevation=20 color_index=2] (s=50 cmap='fire')
y,x = np.mgrid[-5:5, -5:5] * 0.1
heights = np.sin(x**2+y**2)
hv.Scatter3D(zip(x.flat,y.flat,heights.flat))

# Just like all regular 2D elements, ``Scatter3D`` types can be overlaid and will follow the default color cycle: 
#

# %%opts Scatter3D [size_index='Size' scaling_factor=5] (marker='^')
hv.Scatter3D(np.random.randn(100,4), vdims='Size') * hv.Scatter3D(np.random.randn(100,4)+2, vdims='Size')

# For full documentation and the available style and plot options, use ``hv.help(hv.Scatter3D).``

StarcoderdataJupyterScriptsDedupFiltered