In [ ]:
from k3d import K3D
from numpy import mgrid

resolution = 30
X, Y, Z = mgrid[:resolution, :resolution, :resolution]
scalars_field = ((X-15.0)/15.0)**2 + ((Y-15.0)/15.0)**2 + ((Z-15.0)/15.0)**2

view_matrix = (
    1.0, 0.0, 0.0, 0.2,
    0.0, 1.0, 0.0, 0.0,
    0.0, 0.0, 1.0, 27.5,
    0.0, 0.0, 0.0, 1.0
)

plot = K3D()
plot += K3D.marching_cubes(view_matrix, scalars_field, resolution, isolation=0.8)
plot.display()