voronoi_plot_2d(vor, ax=None, **kw)
Requires Matplotlib.
Diagram to plot
Axes to plot on
Add the Voronoi points to the plot.
Add the Voronoi vertices to the plot.
Specifies the line color for polygon boundaries
Specifies the line width for polygon boundaries
Specifies the line alpha for polygon boundaries
Specifies the size of points
Figure for the plot
Plot the given Voronoi diagram in 2-D
Set of point:
>>> import matplotlib.pyplot as plt
... rng = np.random.default_rng()
... points = rng.random((10,2))
Voronoi diagram of the points:
>>> from scipy.spatial import Voronoi, voronoi_plot_2d
... vor = Voronoi(points)
using voronoi_plot_2d
for visualisation:
>>> fig = voronoi_plot_2d(vor)
using voronoi_plot_2d
for visualisation with enhancements:
>>> fig = voronoi_plot_2d(vor, show_vertices=False, line_colors='orange',See :
... line_width=2, line_alpha=0.6, point_size=2)
... plt.show()
The following pages refer to to this document either explicitly or contain code examples using this.
scipy.spatial._qhull.Voronoi
scipy.spatial._plotutils.voronoi_plot_2d
Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.
Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)
SVG is more flexible but power hungry; and does not scale well to 50 + nodes.
All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them