# Trisurface ¶

Title
TriSurface Element
Dependencies
Matplotlib
Backends
Matplotlib
In [1]:
import numpy as np
import holoviews as hv
hv.extension('matplotlib')


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 [azimuth=30 elevation=30 fig_size=200]
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]:

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

In [3]:
%%opts TriSurface [fig_size=200 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]:

For full documentation and the available style and plot options, use  hv.help(hv.TriSurface).
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 1, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "math_score": 0.15634411573410034, "perplexity": 12160.554295647597}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "plain"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "warc_path": "s3://commoncrawl/crawl-data/CC-MAIN-2018-26/segments/1529267862929.10/warc/CC-MAIN-20180619115101-20180619135101-00218.warc.gz"}