Table of Contents

Class PlotFigure

Namespace
Gym.Utils
Assembly
Gym.Rendering.dll

PlayPlot's default figure: matplotlib's default layout (a 640 by 480 white figure, axes at its subplot parameters, blue round markers) drawn with Gym.Rendering and shown in a window from the viewer factory at each Pause(double). No text is drawn (no titles, ticks or labels): the window's title names the plots, top to bottom.

public sealed class PlotFigure : IPlotFigure
Inheritance
PlotFigure
Implements
Inherited Members
Extension Methods

Remarks

Not matplotlib's rendering, and not compared with it: only the data PlayPlot hands it is Gymnasium's. The y range follows the data with matplotlib's 5% margins; a range of one value is widened by 5% of it (0.05 around zero), as matplotlib widens identical limits. The window opens at the first Pause(double), as matplotlib shows a figure there.

Constructors

PlotFigure(int, EnvViewerFactory?)

A figure of rows axes (matplotlib's plt.subplots(rows)).

public PlotFigure(int rows, EnvViewerFactory? viewerFactory = null)

Parameters

rows int

The number of axes, at least 1.

viewerFactory EnvViewerFactory

The window's factory; null reads Gymnasium.HumanViewerFactory.

Exceptions

ValueError

Thrown for fewer than one row, with matplotlib's message: Number of rows must be a positive integer, not 0.

DependencyNotInstalled

Thrown when no viewer factory is given or set.

Fields

Height

The figure's height in pixels: matplotlib's 4.8 inches at 100 dots per inch.

public const int Height = 480

Field Value

int

Width

The figure's width in pixels: matplotlib's 6.4 inches at 100 dots per inch.

public const int Width = 640

Field Value

int

Properties

Axes

The axes, top to bottom.

public IReadOnlyList<IPlotAxes> Axes { get; }

Property Value

IReadOnlyList<IPlotAxes>

Methods

Pause(double)

Draws the figure and shows it in its window, opening the window the first time; then sleeps interval seconds.

public void Pause(double interval)

Parameters

interval double

The pause in seconds; under a millisecond only yields the thread.

Exceptions

ArgumentOutOfRangeException

Thrown for a negative or non-finite interval.

Subplots(EnvViewerFactory?)

The maker PlayPlot takes, with a viewer factory of the caller's.

public static PlayPlot.PlotSubplots Subplots(EnvViewerFactory? viewerFactory = null)

Parameters

viewerFactory EnvViewerFactory

The windows' factory; null reads Gymnasium.HumanViewerFactory when a figure is made.

Returns

PlayPlot.PlotSubplots

The maker.