mrdja.matplot3d.draw_polygon

mrdja.matplot3d.draw_polygon(vertices: ndarray, color: str = 'red', alpha: float = 0.5, ax=None)[source]

Draws a polygon in 3D space.

Parameters:
  • vertices (numpy.ndarray) – A Nx3 numpy array containing the vertices of the polygon.

  • color (str) – The color of the polygon to draw.

  • style (str) – The style of the polygon to draw.

  • ax (matplotlib.axes._subplots.Axes3DSubplot) – The matplotlib ax object to draw on.

Returns:

The ax object.

Return type:

matplotlib.axes._subplots.Axes3DSubplot

Example:

>>> import mrdja.matplot3d as plt3d
>>> import numpy as np
>>> vertices = np.array([[0, 0, 0], [1, 1, 1], [1, 0, 0]])
>>> plt3d.draw_polygon(vertices, color="blue", alpha=0.2)

matplot3d_draw_polygon_example