spacr.qt.widgets.grouped_plot¶
Render data-backed grouped comparisons with interchangeable graph types.
A PlotSpec retains the source frame, group and value columns,
observation unit, and selected graph type. Retaining these data allows the
widget to redraw compatible graph types and export the figure together with
its source rows and statistical comparison.
Classes¶
A pyqtgraph plot of a |
|
Data and display metadata required to render a grouped plot. |
Module Contents¶
- class spacr.qt.widgets.grouped_plot.GroupedPlot(spec: PlotSpec | None = None, parent=None, **kwargs)[source]¶
Bases:
spacr.qt.widgets.fast_plots.FastPlotA pyqtgraph plot of a
PlotSpec, redrawable as any kind.- Variables:
spec – what is drawn. Assign through
show_spec().- Parameters:
spec – what to draw.
Nonebuilds an empty plot; assign later throughshow_spec()rather than by settingspec.parent – parent widget.
Create the grouped plot, optionally drawing a spec straight away.
- Parameters:
spec – the plot to draw;
Noneleaves the plot empty.parent – parent widget, or
None.kwargs – passed through to the base plot.
- comparison_groups() dict | None[source]¶
Return grouped values for export-time statistical comparison.
Returns
Noneunless the retained specification contains at least two groups.
- comparison_unit() str[source]¶
What one point on this plot IS – a well, a field, an object.
NAMED RATHER THAN ASSUMED, because it decides what a comparison means: the same data compared per well and per object gives different p-values, and only one of them answers the question asked.
- Returns:
the unit’s name,
observationwhen unspecified.
- export_settings() dict[source]¶
The parent’s export settings, plus this plot’s grouping.
- Returns:
the settings dict.
- show_as(kind: str) int[source]¶
Redraw the retained data using graph type
kind.- Raises:
ValueError – for a kind this data cannot support. Drawing it would otherwise imply a relationship unsupported by the available data shape.
- class spacr.qt.widgets.grouped_plot.PlotSpec[source]¶
Data and display metadata required to render a grouped plot.
The retained frame supports graph-type compatibility checks, redrawing, data export, and statistical comparison without reconstructing the plot from rendered graphics.
- groups() Dict[str, numpy.ndarray][source]¶
Return
{label: values}while preserving frame order.Preserving first occurrence keeps deliberately ordered experimental conditions, including controls, in their configured display order.