Navigation

Operators and Keywords

Function List:

C++ API

: voronoi (x, y)
: voronoi (x, y, options)
: voronoi (…, "linespec")
: voronoi (hax, …)
: h = voronoi (…)
: [vx, vy] = voronoi (…)

Plot the Voronoi diagram of points (x, y).

The Voronoi facets with points at infinity are not drawn.

The options argument, which must be a string or cell array of strings, contains options passed to the underlying qhull command. See the documentation for the Qhull library for details http://www.qhull.org/html/qh-quick.htm#options.

If "linespec" is given it is used to set the color and line style of the plot.

If an axis graphics handle hax is supplied then the Voronoi diagram is drawn on the specified axis rather than in a new figure.

If a single output argument is requested then the Voronoi diagram will be plotted and a graphics handle h to the plot is returned.

[vx, vy] = voronoi (…) returns the Voronoi vertices instead of plotting the diagram.

x = rand (10, 1);
y = rand (size (x));
h = convhull (x, y);
[vx, vy] = voronoi (x, y);
plot (vx, vy, "-b", x, y, "o", x(h), y(h), "-g");
legend ("", "points", "hull");

See also: voronoin, delaunay, convhull.

Demonstration 1

The following code

 voronoi (rand (10,1), rand (10,1));

Produces the following figure

Figure 1

Package: octave