Skip to content

Figures

Bellow you can find the documentation of figure-plotting functions.

Basic

smartreport.v3.plot.figures.basic.plot_background_text(text, **kwargs)

Makes an empty figure with background text.

Can be useful to plot the placeholder image when the data is missing or the plot is not supported.

Parameters:

Name Type Description Default
text str

Text to be displayed in the background.

required

Other Parameters:

Name Type Description
figsize Tuple[int, int]

Defines the proportion of the figure. Default: (2, 1)

layout BaseLayout

Layout to be used. Default: VerticalPlotLayout

Returns:

Type Description
Figure

Figure with background text.

Drive KPIs

smartreport.v3.plot.figures.drive_kpi.plot_drive_kpi_trend(df, **kwargs)

Makes a figure with two subplots. Top plot shows a trend of measured value, against the thresholds and min-max limits (if provided). The bottom one plots a timeline of the KPI value.

Since both subplots are drawn against the same time range, they do share the X axis.

The figure uses a custom TrendWithTimelineLayout layout, based on the VerticalPlotLayout.

Parameters:

Name Type Description Default
df DataFrame

Data frame with Drive KPI data.

required

Other Parameters:

Name Type Description
line_color str

Color of the trend line. Default: ABBCommonUXColors.BLUE_60

name str

Name of the KPI. Default ``

trend_key str

Name of the column with trend values. If not provided, trend plot timeline is not plotted.

min_trend_key str

Name of the column with min values. If not provided, min-max area is not plotted.

max_trend_key str

Name of the column with max values. If not provided, min-max area is not plotted.

kpi_trend_key str

Name of the column with KPI values. If not provided, KPI timeline is not plotted. Default: KPI.

low_threshold Threshold

Low threshold to be plotted on trend plot. If not provided, Low threshold is not plotted

high_threshold Threshold

High threshold to be plotted on trend plot. If not provided, High threshold is not plotted

unit str

Unit of the trend signal. Default: ``

legend_labels Dict[str, str]

Labels for the plot. Default: None

Returns:

Type Description
Figure

Figure with Drive KPI plot.

smartreport.v3.plot.figures.drive_kpi.plot_climatic_condition_kpi_scatter(df, limits, **kwargs)

Makes a figure with climatic condition points plotted against climatic condition limits.

First, it draws climatic condition limits provided as a sequence of Polygon objects using draw_polygon function.

Then the climatic condition points are drawn using draw_scatter_points on the 2d plane. By default, the X axis is temperature and the Y Axis is relative humidity.

The figure uses the VerticalPlotLayout.

Parameters:

Name Type Description Default
df DataFrame

Data frame with Drive KPI data.

required
limits Sequence[Polygon]

Sequence of limits represented as Polygon objects.

required

Other Parameters:

Name Type Description
x_key str

Key of the X values in the provided data frame. Default: temperature

y_key str

Key of the Y values in the provided data frame. Default: relativeHumidity

x_title str

Title of the X axis. Default: Temperature

y_title str

Title of the Y axis. Default: Relative humidity

x_unit str

Unit of the X values. Default: °C

y_unit str

Unit of the Y values. Default: %

limit_colors Sequence[str]

Sequence of the limit polygon colors. Must be in sync with provided limits. Default: <ABB Colors20>

limit_names Sequence[str]

Sequence of the limit polygon names. Must be in sync with provided limits. Default " "

name str

Name of the scatter points. Default ``

figsize Tuple[int, int]

Defines the proportion of the figure. Default: (4, 1)

Returns:

Type Description
Figure

Figure with Drive KPI plot.

Timeline

smartreport.v3.plot.figures.timeline.plot_kpi_timeline(df, **kwargs)

Makes a figure KPI timeline plot for a single asset.

This plot uses draw_timeline function to represent KPI state on a datetime X axis.

The figure uses the TimelinePlotLayout.

Parameters:

Name Type Description Default
df DataFrame

Data frame with Drive KPI data. The data should come from a single asset.

required

Other Parameters:

Name Type Description
name str

Name of the KPI. Default ``

kpi_column_name str

Name of the column with KPI values. If not provided, KPI timeline is not plotted. Default: KPI.

figsize Tuple[int, int]

Defines the proportion of the figure. Default: (4, 1)

Returns:

Type Description
Figure

Figure with Timeline KPI plot.

smartreport.v3.plot.figures.timeline.plot_kpi_timelines(df, **kwargs)

Makes a figure with KPI timeline plot for the fleet of assets.

This plot uses draw_timelines function to represent KPI states on a datetime X axis.

It expects the input data to be provided as a DataFrame with id_column_name column identifying the asset, and kpi_column_name column with KPI values.

The figure uses the TimelinePlotLayout.

Parameters:

Name Type Description Default
df DataFrame

Data frame with Drive KPI data. The data should come from one or more assets. Assets are identified by id_column_name column.

required

Other Parameters:

Name Type Description
name str

Name of the KPI. Default ``

kpi_column_name str

Name of the column with KPI values. If not provided, KPI timeline is not plotted. Default: KPI.

id_column_name str

Name of the column with asset id. Default: id

figsize Tuple[int, int]

Defines the proportion of the figure. Default: (4, 1)

color_mapping Dict

Dictionary that maps the values in the data series into colors. If not provided, then default plotly colors are used.

label_mapping Dict

Dictionary that maps the values in the data series into label names. If not provided, then data values are used.

show_all_items_on_legend bool

If True, then all the items from the color_mapping are shown on the legend.

Returns: Figure with Timeline KPI plot.

Donut

smartreport.v3.plot.figures.donut.plot_donut(charts, **kwargs)

Makes a figure with donut plot.

The donut plot is based on provided sequence of ChartElement objects. Those object contains all information needed to create a plot. That includes: name, value and optionally color, and extra_text.

The legend of each element is build in following way:

name
<b>extra_text</b>

The figure uses the DonutPlotLayout.

Parameters:

Name Type Description Default
charts Sequence[ChartElement]

Sequence of Chart Element object that contains information about pie chart elements.

required

Other Parameters:

Name Type Description
color Sequence[str]

List of colors as strings. They are only used if the ChartElement's are missing the color values.

figsize Tuple[int, int]

Defines the proportion of the figure. Default: (3, 2)

Returns:

Type Description
Figure

Figure with Donut plot.

Signals

smartreport.v3.plot.figures.signals.plot_signal_in_time(signal, **kwargs)

Makes a figure that shows a RawDataSignal in a time domain. The Y-axis is the signal value in signal units, and the X-axis is the time in seconds. Time starts from 0.0 seconds.

This is a basic line plot, with no threshold or any other information.

The figure uses a custom VerticalPlotLayout layout.

Parameters:

Name Type Description Default
signal RawDataSignal

RawDataSignal to be plotted.

required

Other Parameters:

Name Type Description
layout BaseLayout

Layout to be used. Default: VerticalPlotLayout(plot_line_width_px=2)

title str

Title of the plot. Default: ""

color str

Color of the line. Default: Colors20.C01.value

x1_axis_title str

Title of the X-axis. Default: "Time (s)"

y1_axis_title str

Title of the Y-axis. Default: ""

wrap_y_label bool

Whether to wrap Y-axis label. Default: False

use_scattergl bool

Whether to use a Scattergl trace type. Default: False

Returns:

Type Description
FT

Figure with Signal plot.

smartreport.v3.plot.figures.signals.plot_signal_in_frequency(spectrum, vertical_lines_groups=None, peak_points=None, **kwargs)

Makes a figure that shows a RawDataSignalSpectrum in a frequency domain. The Y-axis is the signal frequency magnitude/amplitude in signal units, and the X-axis is the frequency in Hertz.

The figure uses a RawDataSignalSpectrum as a source of the frequency domain data.

Additionally, the x-axis can be limited with the hard_cut_off_high and dynamic_cut_off_high parameters. Hard cut-off frequency is the maximum frequency in Hz that will be shown on the x-axis. Dynamic cut-off frequency is a relative value (0.0, 1.0) that is used to find the minimum frequency that keeps all signal values above the threshold.

The main trace is a line plot with the frequency domain representation of the signal. The figure can show vertical lines on the plot. They are defined with the vertical_lines_groups parameter. This can be used to show specific frequencies of interest, such as harmonics or sidebands. Also, it can show peak points on the plot, which are defined with the peak_points parameter.

The figure uses a custom VerticalPlotLayout layout.

Parameters:

Name Type Description Default
spectrum RawDataSignalSpectrum

RawDataSignalSpectrum to be plotted.

required
vertical_lines_groups Optional[Sequence[SpectrumPointsGroup]]

List of VerticalLinesGroup objects to be plotted on the figure.

None
peak_points Optional[SpectrumPointsGroup]

Optional object with a collection of peak points to be plotted on the figure.

None

Other Parameters:

Name Type Description
layout BaseLayout

Layout to be used. Default: VerticalPlotLayout(plot_line_width_px=2)

cut_off_low float

Low cut-off frequency in Hertz. Default: None

cut_off_high float

High cut-off frequency in Hertz. Default: None

hard_cut_off_high float

Hard cut-off frequency in Hertz. Default: None

dynamic_cut_off_high float

Dynamic cut-off frequency, as a proportion to the signal maximum. Default: None

filter_order int

Filter order for FFT. Default: 3

title str

Title of the plot. Default: ""

color str

Color of the line. Default: Colors20.C01.value

use_logscale bool

Whether to use log scale for Y-axis. Default: False

x1_axis_title str

Title of the X-axis. Default: "Frequency (Hz)"

y1_axis_title str

Title of the Y-axis. Default: "dB"

wrap_y_label bool

Whether to wrap Y-axis label. Default: False

use_scattergl bool

Whether to use a Scattergl trace type. Default: False

hover_precision int

Precision of the numbers in the hover template. Default: 3g

Returns:

Type Description
FT

Figure with Signal plot in the frequency domain.

Condition Indices

smartreport.v3.plot.figures.condition_indices.plot_threshold_crossing_index_details(df, **kwargs)

Plot the details of the Threshold Crossing Index.

It takes the input DataFrame with the condition index results data and creates a 4-row plot, with the following components:

  1. Input Signal
  2. Running State Input
  3. Extended Condition Index
  4. Condition Index Timeline

Parameters:

Name Type Description Default
df DataFrame

DataFrame containing the condition index results data.

required

Other Parameters:

Name Type Description
template str

Template to be used for the figure. Default: "simple_white"

title str

Title of the figure. Default: "Threshold Crossing Index"

subtitle str

Subtitle of the figure. Default: ""

Returns:

Type Description
Figure

A Plotly figure containing the Threshold Crossing Index details.

smartreport.v3.plot.figures.condition_indices.plot_trend_detection_index_details(df, **kwargs)

Plot the details of the Trend Detection Index.

It takes the input DataFrame with the condition index results data and creates a 4-row plot, with the following components:

  1. Input Signal (with Holt Level if available)
  2. Running State Input
  3. Extended Condition Index (based on the Holt Trend)
  4. Condition Index Timeline

Parameters:

Name Type Description Default
df DataFrame

DataFrame containing the condition index results data.

required

Other Parameters:

Name Type Description
template str

Template to be used for the figure. Default: "simple_white"

title str

Title of the figure. Default: "Trend Detection Index"

subtitle str

Subtitle of the figure. Default: ""

Returns:

Type Description
Figure

A Plotly figure containing the Trend Detection Index details.

smartreport.v3.plot.figures.condition_indices.plot_combined_index_details(dfs, **kwargs)

Plots the combined condition indices details.

This function creates a multi-row plot that combines the details of different condition indices into a single figure.

It includes the following components:

  1. Running State Input
  2. Input Signal (with thresholds and short-term and long-term trend lines)
  3. Condition Index Timeline for Threshold Crossing
  4. Condition Index Timeline for Short-Term Trend Detection
  5. Condition Index Timeline for Long-Term Trend Detection

Parameters:

Name Type Description Default
dfs Dict[ConditionIndexModelType, DataFrame]

Dictionary containing DataFrames for each condition index type.

required

Other Parameters:

Name Type Description
template str

Template to be used for the figure. Default: "simple_white"

title str

Title of the figure. Default: "Combined Condition Indices"

subtitle str

Subtitle of the figure. Default: ""

Returns:

Type Description
Figure

A Plotly figure containing the combined condition indices details.