@@ -0,0 +1,1753 @@
+%22%22%22%0AAn example which shows how to plot a surface from data acquired%0Airregularly.%0A%0AData giving the variation of a parameter 'z' as a function of two others%0A('x' and 'y') is often plotted as a %60carpet plot%60, using a surface to%0Avisualize the underlying function. when the data has been acquired on a%0Aregular grid for parameters 'x' and 'y', it can simply be view with the%0Amlab.surf function. However, when there are some missing points, or the%0Adata has been acquired at random, the surf function cannot be used. %0A%0AThe difficulty stems from the fact that points positionned in 3D do%0Anot define a surface if no connectivity information is given. With the%0Asurf function, this information is implicite from the shape of the input%0Aarrays.%0A%0AIn this example, randomly-positionned points in the (x, y) plane are%0Aembedded in a surface in the z axis. We first visualize the points using%0Amlab.points3d. When then use the delaunay2d filter to extract the mesh by%0Anearest-neighboor matching, and visualize it using the surf module.%0A%22%22%22%0A# Author: Gael Varoquaux %3Cgael.varoquaux@normalesup.org%3E %0A# Copyright (c) 2009, Enthought, Inc.%0A# License: BSD Style.%0A%0Aimport numpy as np%0A%0A# Create data with x and y random in the %5B-2, 2%5D segment, and z a%0A# Gaussian function of x and y.%0Anp.random.seed(12345)%0Ax = 4*(np.random.random(500) - 0.5)%0Ay = 4*(np.random.random(500) - 0.5)%0A%0Adef f(x, y):%0A    return np.exp(-(x**2 + y**2))%0A%0Az = f(x, y)%0A%0Afrom enthought.mayavi import mlab%0Amlab.figure(1, fgcolor=(0, 0, 0), bgcolor=(1, 1, 1))%0A%0A# Visualize the points%0Apts = mlab.points3d(x, y, z, z, scale_mode='none', scale_factor=0.2)%0A%0A# Create and visualize the mesh%0Amesh = mlab.pipeline.delaunay2d(pts)%0Asurf = mlab.pipeline.surface(mesh)%0A%0Amlab.view(47, 57, 8.2, (0.1, 0.15, 0.14))%0Amlab.show()%0A

Add an example showing the use of the delaunay2d filter to build a surface from a scattered set of points.