Skip to main content
`Ctrl`+`K`

# `StatsWidget`: Display a set of statictics for plot items

Module containing widgets displaying stats from items of a plot.

## `StatsWidget` class

class StatsWidget(parent=None, plot=None, stats=None)

  Bases: `QWidget`

  Widget displaying a set of `Stat` to be displayed on a `StatsTable` and to be apply on items contained in the `Plot` Also contains options to:

  - compute statistics on all the data or on visible data only

  - show statistics of all items or only the active one

  Parameters:

    - parent (QWidget) – Qt parent

    - plot (Union[PlotWidget,SceneWidget]) – The plot containing items on which we want statistics.

    - stats (StatsHandler) – Set the statistics to be displayed and how to format them using

  sigVisibilityChanged

    Signal emitted when the visibility of this widget changes.

    It Provides the visibility of the widget.

  showEvent(self, a0: QShowEvent | None)
  hideEvent(self, a0: QHideEvent | None)
  setStats(statsHandler)

    Set which stats to display and the associated formatting.

    Parameters:

      statsHandler (StatsHandler) – Set the statistics to be displayed and how to format them using

  setPlot(plot)

    Define the plot to interact with

    Parameters:

      plot (Union[PlotWidget,SceneWidget,None]) – The plot containing the items on which statistics are applied

  getPlot()

    Returns the plot attached to this widget

    Return type:

      Union[PlotWidget,SceneWidget,None]

  setDisplayOnlyActiveItem(displayOnlyActItem)

    Toggle display off all items or only the active/selected one

    Parameters:

      displayOnlyActItem (bool) – True if we want to only show active item

  setStatsOnVisibleData(b)

    Toggle computation of statistics on whole data or only visible ones.

    Warning

    When visible data is activated we will process to a simple filtering of visible data by the user. The filtering is a simple data sub-sampling. No interpolation is made to fit data to boundaries.

    Parameters:

      b (bool) – True if we want to apply statistics only on visible data

  getUpdateMode()

    Returns update mode (See `setUpdateMode()`).

    Returns:

      update mode

    Return type:

      UpdateMode

  setUpdateMode(mode)

    Set the way to update the displayed statistics.

    Parameters:

      mode (Union[str,UpdateMode]) – mode requested for update

## `BasicStatsWidget` class

class BasicStatsWidget(parent=None, plot=None)

  Bases: `StatsWidget`

  Widget defining a simple set of `Stat` to be displayed on a `StatsWidget`.

  Parameters:

    - parent (QWidget) – Qt parent

    - plot (PlotWidget) – The plot containing items on which we want statistics.

    - stats (StatsHandler) – Set the statistics to be displayed and how to format them using

## `StatsTable` class

class StatsTable(parent=None, plot=None)

  Bases: `_StatsWidgetBase`, `TableWidget`

  TableWidget displaying for each items contained by the Plot some information:

  - legend

  - minimal value

  - maximal value

  - standard deviation (std)

  Parameters:

    - parent (QWidget) – The widget’s parent.

    - plot (Union[PlotWidget,SceneWidget]) – `PlotWidget` or `SceneWidget` instance on which to operate

  sigUpdateModeChanged

    Signal emitted when the update mode changed

  setStats(statsHandler)

    Set which stats to display and the associated formatting.

    Parameters:

      statsHandler (StatsHandler) – Set the statistics to be displayed and how to format them using

  setPlot(plot)

    Define the plot to interact with

    Parameters:

      plot (Union[PlotWidget,SceneWidget,None]) – The plot containing the items on which statistics are applied

  clear()

    Define the plot to interact with

    Parameters:

      plot (Union[PlotWidget,SceneWidget,None]) – The plot containing the items on which statistics are applied

  setDisplayOnlyActiveItem(displayOnlyActItem)

    Toggle display off all items or only the active/selected one

    Parameters:

      displayOnlyActItem (bool) – True if we want to only show active item

## `BasicLineStatsWidget` class

class BasicLineStatsWidget(parent=None, plot=None, kind='curve', stats=<silx.gui.plot.stats.statshandler.StatsHandler object>, statsOnVisibleData=False)

  Bases: `QWidget`

  Widget defining a simple set of `Stat` to be displayed on a `LineStatsWidget`.

  Parameters:

    - parent (QWidget) – Qt parent

    - plot (Union[PlotWidget,SceneWidget]) – The plot containing items on which we want statistics.

    - kind (str) – the kind of plotitems we want to display

    - stats (StatsHandler) – Set the statistics to be displayed and how to format them using

    - statsOnVisibleData (bool) – compute statistics for the whole data or only visible ones.

  setUpdateMode(mode)

    Set the way to update the displayed statistics.

    Parameters:

      mode (Union[str,UpdateMode]) – mode requested for update

  getUpdateMode()

    Returns update mode (See `setUpdateMode()`).

    Returns:

      update mode

    Return type:

      UpdateMode

  setPlot(plot)

    Define the plot to interact with

    Parameters:

      plot (Union[PlotWidget,SceneWidget,None]) – The plot containing the items on which statistics are applied

  setStats(statsHandler)

    Set which stats to display and the associated formatting.

    Parameters:

      statsHandler (StatsHandler) – Set the statistics to be displayed and how to format them using

  setKind(kind)

    Change the kind of active item to display :param str kind: kind of item to display information for (‘curve’ …)

  getKind()
    Returns:

      kind of item we want to compute statistic for :rtype: str

  setStatsOnVisibleData(b)

    Toggle computation of statistics on whole data or only visible ones.

    Warning

    When visible data is activated we will process to a simple filtering of visible data by the user. The filtering is a simple data sub-sampling. No interpolation is made to fit data to boundaries.

    Parameters:

      b (bool) – True if we want to apply statistics only on visible data

  showRadioButtons(show)

    show / hide the QRadioButtons

    Parameters:

      show (bool) – if True make RadioButton visible

## `BasicGridStatsWidget` class

class BasicGridStatsWidget(parent=None, plot=None, kind='curve', stats=<silx.gui.plot.stats.statshandler.StatsHandler object>, statsOnVisibleData=False)

  Bases: `QWidget`

  pymca design like widget

  Parameters:

    - parent (QWidget) – Qt parent

    - plot (Union[PlotWidget,SceneWidget]) – The plot containing items on which we want statistics.

    - stats (StatsHandler) – Set the statistics to be displayed and how to format them using

    - kind (str) – the kind of plotitems we want to display

    - statsOnVisibleData (bool) – compute statistics for the whole data or only visible ones.

    - statsPerLine (int) – number of statistic to be displayed per line

  setUpdateMode(mode)

    Set the way to update the displayed statistics.

    Parameters:

      mode (Union[str,UpdateMode]) – mode requested for update

  getUpdateMode()

    Returns update mode (See `setUpdateMode()`).

    Returns:

      update mode

    Return type:

      UpdateMode

  setPlot(plot)

    Define the plot to interact with

    Parameters:

      plot (Union[PlotWidget,SceneWidget,None]) – The plot containing the items on which statistics are applied

  setStats(statsHandler)

    Set which stats to display and the associated formatting.

    Parameters:

      statsHandler (StatsHandler) – Set the statistics to be displayed and how to format them using

  setKind(kind)

    Change the kind of active item to display :param str kind: kind of item to display information for (‘curve’ …)

  getKind()
    Returns:

      kind of item we want to compute statistic for :rtype: str

  setStatsOnVisibleData(b)

    Toggle computation of statistics on whole data or only visible ones.

    Warning

    When visible data is activated we will process to a simple filtering of visible data by the user. The filtering is a simple data sub-sampling. No interpolation is made to fit data to boundaries.

    Parameters:

      b (bool) – True if we want to apply statistics only on visible data

  showRadioButtons(show)

    show / hide the QRadioButtons

    Parameters:

      show (bool) – if True make RadioButton visible