Implementation:Isaac sim IsaacGymEnvs Matplotlib3DPlotter
| Knowledge Sources | |
|---|---|
| Domains | Visualization, Motion_Analysis |
| Last Updated | 2026-02-15 11:00 GMT |
Overview
Matplotlib3DPlotter is a matplotlib-based visualization backend that renders skeleton poses and motion data as interactive 3D line, dot, and trail primitives, extending BasePlotter from the poselib visualization framework.
Description
The Matplotlib3DPlotter class in isaacgymenvs/tasks/amp/poselib/poselib/visualization/plt_plotter.py provides a 3D visualization backend for the poselib skeleton system. It extends BasePlotter and uses matplotlib's mpl_toolkits.mplot3d.axes3d.Axes3D for rendering. The module also contains Matplotlib2DPlotter for 2D visualization, but the 3D variant is the primary class used for skeleton visualization.
The plotter implements a task-based rendering pipeline where drawing operations are registered as task primitives. Three 3D task types are supported: "Draw3DLines" for rendering bone connections between joints, "Draw3DDots" for rendering joint positions as points, and "Draw3DTrail" for showing motion trajectories over time. Each task type has corresponding _create_impl and _update_impl callables that manage matplotlib artist objects cached in _artist_cache.
The __init__() method creates a matplotlib figure with a 3D axis, registers the task primitive callables, and initializes axis limits. The _create_impl() method iterates over the task list and creates initial artist objects, while _update_impl() updates existing artists with new data. The show() method uses matplotlib's FuncAnimation to create an interactive display that updates in real time, suitable for visualizing motion sequences frame by frame. Axis limits are managed dynamically via _init_lim(), _update_lim(), and _set_lim() methods, with optional equal aspect ratio enforcement via _set_aspect_equal_3d().
Usage
Use Matplotlib3DPlotter for debugging and visualizing skeleton poses, motion capture clips, retargeted motions, and AMP reference demonstrations. It is the default visualization backend in the poselib toolkit and is typically used during development and analysis rather than during training.
Code Reference
Source Location
- Repository: IsaacGymEnvs
- File: isaacgymenvs/tasks/amp/poselib/poselib/visualization/plt_plotter.py
- Lines: 1-424
Signature
class Matplotlib2DPlotter(BasePlotter):
"""2D matplotlib plotter for lines, dots, and trails."""
def __init__(self, task: "BasePlotterTask") -> None: ...
def show(self): ...
class Matplotlib3DPlotter(BasePlotter):
_fig: plt.figure
_ax: p3.Axes3D
_artist_cache: Dict[str, Any]
_create_impl_callables: Dict[str, Callable]
_update_impl_callables: Dict[str, Callable]
def __init__(self, task: "BasePlotterTask") -> None:
"""Create 3D figure, register Draw3DLines/Draw3DDots/Draw3DTrail callables."""
@property
def ax(self) -> p3.Axes3D:
"""Access the 3D matplotlib axis."""
@property
def fig(self) -> plt.figure:
"""Access the matplotlib figure."""
def show(self):
"""Display interactive animation using FuncAnimation."""
def _create_impl(self, task_list):
"""Create initial artist objects for all registered tasks."""
def _update_impl(self, task_list):
"""Update existing artists with new frame data."""
def _lines_create_impl(self, lines_task): ...
def _lines_update_impl(self, lines_task): ...
def _dots_create_impl(self, dots_task): ...
def _dots_update_impl(self, dots_task): ...
def _trail_create_impl(self, trail_task): ...
def _trail_update_impl(self, trail_task): ...
def _set_aspect_equal_3d(self, zero_centered=True):
"""Enforce equal aspect ratio on all three axes."""
def _draw(self):
"""Flush canvas and redraw with updated limits."""
Import
from isaacgymenvs.tasks.amp.poselib.poselib.visualization.plt_plotter import Matplotlib3DPlotter
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| task | BasePlotterTask | Yes | Plotter task definition containing the list of drawing primitives (lines, dots, trails) to render |
| lines_task | Draw3DLines | No | Task containing pairs of 3D points to draw as connected line segments (skeleton bones) |
| dots_task | Draw3DDots | No | Task containing 3D points to draw as scatter dots (joint positions) |
| trail_task | Draw3DTrail | No | Task containing sequences of 3D positions to draw as motion trails |
Outputs
| Name | Type | Description |
|---|---|---|
| figure | plt.figure | Interactive matplotlib figure displaying the 3D skeleton visualization |
| animation | FuncAnimation | Animated display cycling through motion frames when show() is called |
Usage Examples
from isaacgymenvs.tasks.amp.poselib.poselib.visualization.plt_plotter import Matplotlib3DPlotter
from isaacgymenvs.tasks.amp.poselib.poselib.visualization.core import BasePlotterTask
# Typically used through the poselib visualization pipeline:
from isaacgymenvs.tasks.amp.poselib.poselib.skeleton.skeleton3d import SkeletonMotion
# Load a motion clip
motion = SkeletonMotion.from_file("assets/amp/motions/walk.npz")
# Create a plotter task from the skeleton data
# (The poselib visualization module provides helper functions for this)
# task = create_skeleton_plotter_task(motion)
# Create the 3D plotter and display
# plotter = Matplotlib3DPlotter(task)
# plotter.show()
# For manual usage with raw data:
import numpy as np
import matplotlib.pyplot as plt
# The plotter manages 3D artist objects internally:
# - Lines connect parent-child joint pairs (skeleton bones)
# - Dots mark joint positions
# - Trails show the path of specific joints over time