Note: This page has been translated by MathWorks. Click here to see

To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

Voronoi diagram

Qhull-specific options are no longer supported. Remove the `OPTIONS`

argument
from all instances in your code that pass it to `voronoi`

.

The behavior of `h = voronoi(...)`

has changed.
The new behavior returns a vector of two chart line handles; one representing
the points and the other representing the Voronoi edges.

`voronoi(x,y)`

voronoi(x,y,TRI)

voronoi(dt)

voronoi(AX,...)

voronoi(...,'LineSpec')

h = voronoi(...)

[vx,vy] = voronoi(...)

`voronoi(x,y)`

plots the
bounded cells of the Voronoi diagram for the points `x`

,`y`

.
Lines-to-infinity are approximated with an arbitrarily distant endpoint.

`voronoi(x,y,TRI)`

uses the
triangulation `TRI`

instead of computing internally.

`voronoi(dt)`

uses the Delaunay triangulation `dt`

instead
of computing it.

`voronoi(AX,...)`

plots into `AX`

instead
of `gca`

.

`voronoi(...,'LineSpec')`

plots
the diagram with color and line style specified.

`h = voronoi(...)`

returns `h`

,
which is a vector of two chart line handles. One represents the points
and the other represents the Voronoi edges.

`[vx,vy] = voronoi(...)`

returns
the finite vertices of the Voronoi edges in `vx`

and `vy`

.

For the topology of the Voronoi diagram, i.e., the vertices
for each Voronoi cell, use `voronoin`

.

[v,c] = voronoin([x(:) y(:)])

Use one of these methods to plot a Voronoi diagram:

If you provide no output argument,

`voronoi`

plots the diagram.To gain more control over color, line style, and other figure properties, use the syntax

`[vx,vy] = voronoi(...)`

. This syntax returns the vertices of the finite Voronoi edges, which you can then plot with the`plot`

function.To fill the cells with color, use

`voronoin`

with`n = 2`

to get the indices of each cell, and then use`patch`

and other plot functions to generate the figure. Note that`patch`

does not fill unbounded cells with color.

Was this topic helpful?