Trisurface

Title
Trisurface Element
Dependencies
Matplotlib
Backends
Matplotlib
Plotly
In [1]:
import numpy as np
import holoviews as hv
hv.notebook_extension('plotly')
The plotly backend is experimental, and is not supported at this time. If you would like to volunteer to help maintain this backend by adding documentation, responding to user issues, keeping the backend up to date as other code changes, or by adding support for other elements, please email holoviews@gmail.com

The Trisurface Element renders any collection of 3D points as a surface by applying Delaunay triangulation . It is therefore useful for plotting an arbitrary collection of datapoints as a 3D surface. Like other 3D elements it supports azimuth , elevation and distance plot options to control the camera position:

In [2]:
%%opts Trisurface [width=500 height=500]
y,x = np.mgrid[-5:5, -5:5] * 0.1
heights = np.sin(x**2+y**2)
hv.Trisurface((x.flat,y.flat,heights.flat))
Out[2]:
Drawing...

Like all other colormapped plots we can easily add a colorbar and control the cmap of the plot:

In [3]:
%%opts Trisurface [width=500 height=500 colorbar=True] (cmap='fire')

u=np.linspace(0,2*np.pi, 24)
v=np.linspace(-1,1, 8)
u,v=np.meshgrid(u,v)
u=u.flatten()
v=v.flatten()

#evaluate the parameterization at the flattened u and v
tp=1+0.5*v*np.cos(u/2.)
x=tp*np.cos(u)
y=tp*np.sin(u)
z=0.5*v*np.sin(u/2.)

surface = hv.Trisurface((x, y, z), label='Moebius band')
surface
Out[3]:
Drawing...

Download this notebook from GitHub (right-click to download).