Statistics bar

The add_stat_bar() method allows to add a bar containing statistics for the plot’s data.
The stat bar can be customized through specific parameters:
  • stats: list of the statistics values to display,

  • nb_digits: number of significant digits number to display (defaults to 4).

The default statistics bar display contains the following statistics:

  • Number of measurements

  • Minimum

  • Mean

  • Median

  • Maximum

  • Standard deviation

Add a bar containing number, minimum, mean, median, maximum and
standard deviation information.

Parameters
----------
position
    position of the stat bar (top, bottom, left, right)
    (default to top)
stats
    List of the statistics to display in the stat bar.
nb_digits
    Number of significant digits for statistics values.
params
    Bar's parameters.

Note

Statistics bar can be fully customized using AxeParams.

Note

For merged plots, configuring plot’s legend(s) will update plot’s reference(s) in the statistics bar.

from casys import AxeParams, CasysPlot, PlotParams

plot = CasysPlot(
    data=ad,
    data_name="SLA box stat",
    stat="std",
    plot_params=PlotParams(color_limits=(0, 1)),
)

param = AxeParams(
    label={
        "fontsize": "x-small",
        "color": "red"
    },
    position="bottom"
)

plot.add_stat_bar(nb_digits=7, stats=["mean", "nbr", "max", "median"], params=param)
plot.show()
../_images/stat_bar_2_0.png

Note

When using the add_plot() method, nb_digits parameter value is specific to each plot. For added plots without a nb_digits specification, the statistics bar number of digits will align on the main plot.
The stats parameter is set by the main plot stats parameter value for all added plots (ignoring their own stats specification).
plot_1 = CasysPlot(
    data=ad,
    data_name="SLA box stat",
    stat="std",
    plot_params=PlotParams(color_limits=(0, 1)),
)
plot_1.add_stat_bar(nb_digits=3, stats=["mean", "nbr", "max", "median"], params=param)

plot_2 = CasysPlot(
    data=ad,
    data_name="SLA",
    plot="map",
    plot_params=PlotParams(color_limits=(0, 1)),
)
plot_2.add_stat_bar(nb_digits=7, stats=["mean", "nbr", "max", "median", "min", "std"], params=param)

plot_1.add_plot(plot_2)
plot_1.show()
../_images/stat_bar_3_0.png