pybop.plotting.quick_plot#

Module Contents#

Classes#

StandardPlot

A class for creating and displaying Plotly figures for model output comparison.

Functions#

quick_plot(params, cost[, title, width, height])

Quickly plot the target dataset against minimized model output.

class pybop.plotting.quick_plot.StandardPlot(x, y, cost, y2=None, title=None, xaxis_title=None, yaxis_title=None, trace_name=None, width=1024, height=576)[source]#

A class for creating and displaying Plotly figures for model output comparison.

Generates interactive plots comparing simulated model output with an optional target dataset and visualizes uncertainty.

Parameters:
  • x (list or np.ndarray) – X-axis data points.

  • y (list or np.ndarray) – Primary Y-axis data points for simulated model output.

  • cost (float) – Cost associated with the model output.

  • y2 (list or np.ndarray, optional) – Secondary Y-axis data points for the target dataset (default: None).

  • title (str, optional) – Title of the plot (default: None).

  • xaxis_title (str, optional) – Title for the x-axis (default: None).

  • yaxis_title (str, optional) – Title for the y-axis (default: None).

  • trace_name (str, optional) – Name for the primary trace (default: “Simulated”).

  • width (int, optional) – Width of the figure in pixels (default: 1024).

  • height (int, optional) – Height of the figure in pixels (default: 576).

__call__()[source]#

Generate the Plotly figure.

Returns:

The generated Plotly figure.

Return type:

plotly.graph_objs.Figure

create_layout()[source]#

Create the layout for the Plotly figure.

Returns:

The layout for the Plotly figure.

Return type:

plotly.graph_objs.Layout

create_traces()[source]#

Create traces for the Plotly figure.

Returns:

A list of plotly.graph_objs.Scatter objects to be used as traces.

Return type:

list

static wrap_text(text, width)[source]#

Wrap text to a specified width with HTML line breaks.

Parameters:
  • text (str) – The text to wrap.

  • width (int) – The width to wrap the text to.

Returns:

The wrapped text.

Return type:

str

pybop.plotting.quick_plot.quick_plot(params, cost, title='Scatter Plot', width=1024, height=576)[source]#

Quickly plot the target dataset against minimized model output.

Parameters:
  • params (array-like) – Optimized parameters.

  • cost (object) – Cost object with problem, dataset, and signal attributes.

  • title (str, optional) – Title of the plot (default: “Scatter Plot”).

  • width (int, optional) – Width of the figure in pixels (default: 1024).

  • height (int, optional) – Height of the figure in pixels (default: 576).

Returns:

The Plotly figure object for the scatter plot.

Return type:

plotly.graph_objs.Figure