statsplotly.plot_specifiers.figure package

This subpackage defines objects and utility methods for figure properties.

pydantic model statsplotly.plot_specifiers.figure.HistogramPlot

Bases: BasePlot[HistogramSpecifier]

Fields:
  • plot_specifier (statsplotly.plot_specifiers.trace.HistogramSpecifier)

Validators:

field plot_specifier: HistogramSpecifier [Required]
classmethod initialize(fig: Figure | None, row: int | None, col: int | None, plot_specifier: HistogramSpecifier) HistogramPlot

This method implements the logic to initialize a subplot layout.

property central_tendency_col: int
property main_row: int

This method returns the index of the main row in the subplot (i.e., the row with the core Figure object).

pydantic model statsplotly.plot_specifiers.figure.JointplotPlot

Bases: BasePlot[JointplotSpecifier]

Fields:
  • plot_specifier (statsplotly.plot_specifiers.trace.JointplotSpecifier)

Validators:

field plot_specifier: JointplotSpecifier [Required]
classmethod initialize(fig: Figure | None, row: int | None, col: int | None, plot_specifier: JointplotSpecifier) JointplotPlot

This method implements the logic to initialize a subplot layout.

tidy_plot() JointplotPlot
property main_row: int

This method returns the index of the main row in the subplot (i.e., the row with the core Figure object).

class statsplotly.plot_specifiers.figure.SharedGridAxis(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)

Bases: str, Enum

ALL = 'all'
COLS = 'cols'
ROWS = 'rows'
pydantic model statsplotly.plot_specifiers.figure.SubplotGridFormatter

Bases: _SubplotGridValidator

Wraps a Plotly Figure with methods to format the subplot grid.

fig

A plotly.graph_objects.Figure with a subplot grid.

Fields:

Validators:

check_common_xaxes_ticks(col_idx: int) bool
check_common_yaxes_ticks(row_idx: int) bool
set_common_axis_limit(shared_grid_axis: str = SharedGridAxis.ALL, plot_axis: str | None = None, common_range: bool = True, link_axes: bool = False) SubplotGridFormatter

Set common axis limits of a plot axis along a shared grid axis, optionally linking the axes.

Parameters:
  • shared_grid_axis – A SharedGridAxis value.

  • plot_axis

    A PlotAxis value.

  • common_range – If True (default), set a common range for the axes targeted by plot_axis.

  • link_axes – If True (default to False), links the axes targeted by plot_axis.

Returns:

A SubplotGridFormatter instance.

set_common_coloraxis(shared_grid_axis: str) SubplotGridFormatter

Set a common coloraxis along a shared grid axis

Parameters:

shared_grid_axis – A SharedGridAxis value.

Returns:

A SubplotGridFormatter instance.

set_suplotgrid_titles(grid_axis: GridAxis) Callable[[...], Any]
tidy_axes() None

Removes titles and ticks of linked axes in a subplot grid.

tidy_subplots(title: str | None = None, no_legend: bool = False, row_titles: list[str] | None = None, col_titles: list[str] | None = None) SubplotGridFormatter

Tidy a subplot grid by removing redundant axis titles and optionally adding annotations.

Parameters:
  • title – A string for the figure title.

  • no_legend – If True, hides the legend.

  • row_titles – A list of string the size of the row dimension specifying a title for each row.

  • col_titles – A list of string the size of the column dimension specifying a title for each column.

Returns:

A SubplotGridFormatter instance.

statsplotly.plot_specifiers.figure.create_fig(fig: Figure, traces: dict[str, BaseTrace], layout: HeatmapLayout | CategoricalLayout | ScatterLayout | SceneLayout | BarLayout | HistogramLayout, row: int | None, col: int | None, secondary_y: bool = False) Figure

Creates or updates a figure with the appropriate layout.