grains.cad.plot_polygon

grains.cad.plot_polygon(vertices, ax=None, **kwargs)[source]

Plots a polygon.

Parameters
  • vertices (ndarray) – 2D ndarray of size Nx2, with each row designating a vertex and the two columns giving the x and y coordinates of the vertices, respectively.

  • ax (matplotlib.axes.Axes, optional) – The Axes instance the polygon is plotted into. The default is None, in which case a new Axes within a new figure is created.

  • **kwargs (Line2D properties, optional) – Keyword arguments accepted by matplotlib.pyplot.plot

Returns

None

Examples

>>> plot_polygon(np.array([[1, 1], [2, 3], [1.5, -3], [-1, 2]]), marker='o');  plt.show()