Visualization¶
Visualizer ¶
Animate a sequence of environment states with Matplotlib.
Supported environments are the classic control tasks (rendered through
Gymnasium, which requires the visualize extra), Catch-bsuite, the MinAtar
games, Pong-misc, PointRobot-misc, MetaMaze-misc and FourRooms-misc.
Other environments are not drawn.
Parameters:
-
env_arg(Environment) –Environment that produced the states.
-
env_params_arg(EnvParams) –Environment parameters used for the rollout.
-
state_seq_arg(list[EnvState]) –List of environment states, one per frame.
-
reward_seq_arg(Array | None, default:None) –Sequence with one value per frame, shown in the title as the return so far; typically the cumulative reward.
animate ¶
Render the animation and optionally save or show it.
The figure is closed afterwards.
Parameters:
-
save_fname(str | None, default:'test.gif') –Output file. A
.gifname is written with Pillow, any other extension with the default Matplotlib writer.Noneskips saving. -
view(bool, default:False) –Whether to show the animation in a window for three seconds.