amep.plot.voronoi#

amep.plot.voronoi(axs: Axes, vor: Voronoi, **kwargs)#

Plots the Voronoi tessellations from a Voronoi object calculated with scipy function voronoi_plot_2d [1].

Notes

References

Parameters:
  • axs (AxisSubplot) – Matplotlib.pyplot AxisSubplot object.

  • voronoi (Voronoi object) – Voronoi object to plot the Voronoi tessellation of.

  • **kwargs (Keyword arguments for the plot.) – show_points, show_vertices, line_colors, line_width, line_alpha, point_size Compare [1]

Returns:

matplotlib figure

Return type:

matplotlib.figure.Figure instance

Examples

>>> import amep
>>> traj = amep.load.traj("../examples/data/lammps.h5amep")
>>> frame = traj[-1]
>>> vor, idx = amep.order.voronoi(
...     frame.coords(), frame.box, pbc=True
... )
>>> fig, axs = amep.plot.new(figsize=(3,3))
>>> amep.plot.voronoi(
...     axs, vor, show_vertices=False, line_colors="orange",
...     line_width=1, line_alpha=0.6, point_size=1, c="b"
... )
>>> amep.plot.box(axs, frame.box)
>>> axs.set_xlabel(r"$x$")
>>> axs.set_ylabel(r"$y$")
>>> fig.savefig("./figures/plot/plot-voronoi.png")
>>>
../_images/plot-voronoi.png