pybop.plotting.quick_plot#
Attributes#
Classes#
A class for creating and displaying interactive Plotly figures. |
|
A class for creating and displaying a set of interactive Plotly figures in a grid layout. |
Functions#
|
Quickly plot one or more trajectories using Plotly. |
Module Contents#
- class pybop.plotting.quick_plot.StandardPlot(x, y, layout=None, layout_options=DEFAULT_LAYOUT_OPTIONS.copy(), trace_options=DEFAULT_TRACE_OPTIONS.copy(), trace_names=None, trace_name_width=40)[source]#
A class for creating and displaying interactive Plotly figures.
- Parameters:
x (list or np.ndarray) – X-axis data points.
y (list or np.ndarray) – Primary Y-axis data points for simulated model output.
layout (Plotly layout, optional) – A layout for the figure, overrides the layout options (default: None).
layout_options (dict, optional) – Settings to modify the default layout (default: DEFAULT_LAYOUT_OPTIONS).
trace_options (dict, optional) – Settings to modify the default trace type (default: DEFAULT_TRACE_OPTIONS).
trace_names (str, optional) – Name(s) for the primary trace(s) (default: None).
trace_name_width (int, optional) – Maximum length of the trace names before text wrapping is used (default: 40).
- Returns:
The generated Plotly figure.
- Return type:
plotly.graph_objs.Figure
- __call__(show=True)[source]#
Generate and show the figure.
- Parameters:
show (bool, optional) – If True, the figure is shown upon creation (default: True).
- create_trace(x, y, **trace_options)[source]#
Create a trace for the Plotly figure.
- Returns:
A trace for a Plotly figure.
- Return type:
plotly.graph_objs.Scatter
- class pybop.plotting.quick_plot.StandardSubplot(x, y, num_rows=None, num_cols=None, axis_titles=None, layout=None, layout_options=DEFAULT_LAYOUT_OPTIONS.copy(), subplot_options=DEFAULT_SUBPLOT_OPTIONS.copy(), trace_options=DEFAULT_SUBPLOT_TRACE_OPTIONS.copy(), trace_names=None, trace_name_width=40)[source]#
Bases:
StandardPlotA class for creating and displaying a set of interactive Plotly figures in a grid layout.
- Parameters:
x (list or np.ndarray) – X-axis data points.
y (list or np.ndarray) – Primary Y-axis data points for simulated model output.
num_rows (int, optional) – Number of rows of subplots, can be set automatically (default: None).
num_cols (int, optional) – Number of columns of subplots, can be set automatically (default: None).
layout (Plotly layout, optional) – A layout for the figure, overrides the layout options (default: None).
layout_options (dict, optional) – Settings to modify the default layout (default: DEFAULT_LAYOUT_OPTIONS).
trace_options (dict, optional) – Settings to modify the default trace type (default: DEFAULT_TRACE_OPTIONS).
trace_names (str, optional) – Name(s) for the primary trace(s) (default: None).
trace_name_width (int, optional) – Maximum length of the trace names before text wrapping is used (default: 40).
- Returns:
The generated Plotly figure.
- Return type:
plotly.graph_objs.Figure
- pybop.plotting.quick_plot.plot_trajectories(x, y, trace_names=None, show=True, **layout_kwargs)[source]#
Quickly plot one or more trajectories using Plotly.
- Parameters:
x (list or np.ndarray) – X-axis data points.
y (list or np.ndarray) – Y-axis data points for each trajectory.
trace_names (list or str, optional) – Name(s) for the trace(s) (default: None).
**layout_kwargs (optional) – Valid Plotly layout keys and their values, e.g. xaxis_title=”Time / s” or xaxis={“title”: “Time / s”, “titlefont_size”: 18}.
- Returns:
The Plotly figure object for the scatter plot.
- Return type:
plotly.graph_objs.Figure