Time Plot (Abstract)
The TimePlot is the base class for all plots that plot data with the time on the x-axis.
- class gym_electric_motor.visualization.motor_dashboard_plots.TimePlot[source]
Bases:
MotorDashboardPlot
Base class for all MotorDashboardPlots that have the cumulative simulated time on the x-Axis.
These use fixed-size numpy-arrays as x and y data. The plot is moved along the time axis and old data is cut out. Furthermore, if the environment is reset manually or a limit violation occurs, a blue or red vertical line is plotted to indicate these cases in the timeline.
- initialize(axis)
Initialization of the plot.
It is called by the MotorDashboard. Set labels, legends… when overriding this method.
- Parameters:
axis (matplotlib.pyplot.axis) – Axis to plot in
- on_close()
Gets called at the beginning of a close
- on_reset_end(state, reference)
Gets called at the end of each reset
- on_step_begin(k, action)
Gets called at the beginning of each step
- render()[source]
Update of the plots axis.
The current x and y-data are written onto the respective lines in this methods. Furthermore the x- and y-axes are scaled dynamically.
- set_width(width)[source]
Sets the width of the plot in data points.
- Parameters:
width (int > 0) – The width of the plot
- property data_idx
Returns the current index to access the time and data arrays.