import numpy as np import holoviews as hv hv.extension('matplotlib')
is used for a set of gridded points whose associated value dimension represents samples from a continuous surface.
is equivalent to an
type and supports all the same data formats, including simply NumPy arrays with associated
and other gridded data formats such as xarray.
Rendering a large can often be quite expensive, using
we can draw a coarser surface. We can also control the
as plot options to control the camera angle:
%%opts Surface [azimuth=30 elevation=30] (cmap='plasma' rstride=20, cstride=2) hv.Surface(np.sin(np.linspace(0,100*np.pi*2,10000)).reshape(100,100))
In addition to a simple surface plots, the matplotlib surface plot also supports other related
%%opts Surface [azimuth=60] (cmap='fire' linewidth=1 edgecolor='black') Layout [fig_size=150 hspace=0.1] xs = np.arange(-4, 4, 0.25) ys = np.arange(-4, 4, 0.25) X, Y = np.meshgrid(xs, ys) R = np.sqrt(X**2 + Y**2) Z = np.sin(R) surface = hv.Surface((xs, ys, Z)) surface + surface.opts(plot=dict(plot_type='wireframe')) + surface.opts(plot=dict(plot_type='contour'))