Note that in this case each time the dataset is transferred. (opposite to marching cubes plot)
import k3d
import numpy as np
from ipywidgets import interact, interactive, fixed
import ipywidgets as widgets
import time
plot = k3d.plot()
Nx = 264
Ny = 264
xmin,xmax = -3,3
ymin,ymax = 0,3
x = np.linspace(xmin,xmax,Nx)
y = np.linspace(ymin,ymax,Ny)
x,y = np.meshgrid(x,y,indexing='ij')
surface = k3d.surface(np.sin(x**2+y**2),xmin=xmin,xmax=xmax,ymin=ymin,ymax=ymax,\
color=int(np.random.randint(0, 0xFFFFFF, 1)[0]))
plot += surface
plot.camera_auto_fit = False
plot.grid_auto_fit = False
surface.heights = (np.sin(x**2)+np.cos(y**3))
surface.color=0xff0000
@interact(phi=widgets.FloatSlider(value=0.,min=0,max=2*np.pi,step=0.1))
def g(phi):
f = np.sin(x**2+y**2-phi)
surface.heights = f
plot.display()
%time data = (np.sin(x**2)+np.cos(y**3))
%time surface.heights = data+2