Matplot3d Module
Module for functions that take an ax object, draw something, and return the ax object. This is useful for chaining calls to these functions.
|
Draws a circle in 3D space. |
|
Draws a circumference in 3D space. |
|
Draws points in 3D space. |
|
Draws a polygon in 3D space. |
|
Draws a line in 3D space. |
- matplot3d.draw_circle(center: ndarray = array([0, 0, 0]), radius: float = 1, normal: ndarray = array([0, 0, 1]), color: str = 'red', alpha: float = 0.5, ax=None)[source]
Draws a circle in 3D space.
- Parameters:
center (numpy.ndarray) – A 3x1 numpy array containing the center of the circle.
radius (float) – The radius of the circle to draw.
normal (numpy.ndarray) – The normal vector of the circle.
color (str) – The color of the circle to draw.
style (str) – The style of the circle 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 rsaitehu.matplot3d as plt3d >>> import numpy as np >>> center = np.array([0, 0, 0]) >>> radius = 1 >>> normal = np.array([0.5, 0.3, 0.8]) / np.linalg.norm(np.array([0.5, 0.3, 0.8])) >>> plt3d.draw_circle(center, radius, normal, color="blue", alpha=0.2)

- matplot3d.draw_circumference(center: ndarray = array([0, 0, 0]), radius: float = 1, normal: ndarray = array([0, 0, 1]), color: str = 'red', alpha: float = 0.5, ax=None)[source]
Draws a circumference in 3D space.
- Parameters:
center (numpy.ndarray) – A 3x1 numpy array containing the center of the circumference.
radius (float) – The radius of the circumference to draw.
normal (numpy.ndarray) – The normal vector of the circumference.
color (str) – The color of the circumference to draw.
style (str) – The style of the circumference 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 rsaitehu.matplot3d as plt3d >>> import numpy as np >>> center = np.array([0, 0, 0]) >>> radius = 1 >>> normal = np.array([0.5, 0.3, 0.8]) / np.linalg.norm(np.array([0.5, 0.3, 0.8])) >>> plt3d.draw_circumference(center, radius, normal, color="blue", alpha=0.2)

- matplot3d.draw_points(points: ndarray, color: str = 'red', style: str = 'o', alpha: float = 0.5, ax=None)[source]
Draws points in 3D space.
- Parameters:
points (numpy.ndarray) – A Nx3 numpy array containing the points to draw.
color (str) – The color of the points to draw.
style (str) – The style of the points to draw.
alpha (float) – The transparency of the points 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 rsaitehu.matplot3d as plt3d >>> import numpy as np >>> points = np.array([[0, 0, 0], [1, 1, 1], [1, 0, 0]]) >>> plt3d.draw_points(points, color="blue", style="o")

- 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 rsaitehu.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_segment(line: ndarray, color: str = 'red', style: str = '-', ax=None)[source]
Draws a line in 3D space.
- Parameters:
segment (numpy.ndarray) – A 2x3 numpy array containing the endpoints of the segment.
color (str) – The color of the segment to draw.
style (str) – The style of the segment 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 rsaitehu.matplot3d as plt3d >>> import numpy as np >>> segment = np.array([[0, 0, 0], [1, 1, 1]]) >>> plt3d.draw_segment(segment, color="blue", style="--")
