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]¶
- 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, col: int, plot_specifier: JointplotSpecifier) JointplotPlot¶
Initializes a subplot layout.
- tidy_plot() JointplotPlot¶
Tidies up the jointplot figure layout.
We are limited to formatting only axes in the figure, as in the current implementation of jointplot, coloraxes are managed at the trace level instead of the layout level.
Bases:
StrEnum
- pydantic model statsplotly.plot_specifiers.figure.SubplotGridFormatter¶
Bases:
_SubplotGridValidatorWraps a Plotly Figure with methods to format the subplot grid.
- fig¶
A
plotly.graph_objects.Figurewith a subplot grid.
- Fields:
- Validators:
- set_common_axis_limit(shared_grid_axis: Literal['cols', 'rows', 'all'] = 'all', plot_axis: Literal['xaxis', 'yaxis', 'coloraxis'] | None = None, common_range: bool = True, link_axes: bool = False) SubplotGridFormatter¶
Set common axis limits along a shared grid axis, optionally linking the axes.
- Parameters:
shared_grid_axis – A
SharedGridAxisvalue.plot_axis –
A
PlotAxisvalue.Defaults to
YAXISwhenshared_grid_axis=rows.Defaults to
XAXISwhenshared_grid_axis=cols.Raises a
StatsPlotSpecificationErrorwhenNoneandshared_grid_axis=all.
common_range – If
True(default), set a common range for the axes targeted byplot_axis.link_axes – If
True(defaultFalse), link the axes targeted byplot_axis.
- Returns:
A
SubplotGridFormatterinstance.
- set_common_coloraxis(shared_grid_axis: SharedGridAxis) SubplotGridFormatter¶
Set a common coloraxis along a shared grid axis.
- Parameters:
shared_grid_axis – A
SharedGridAxisvalue.- Returns:
A
SubplotGridFormatterinstance.
- tidy_subplots(title: str | None = None, no_legend: bool = False, row_titles: Sequence[str] | None = None, col_titles: Sequence[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
SubplotGridFormatterinstance.
- statsplotly.plot_specifiers.figure.create_fig(fig: Figure | None, traces: dict[str, BaseTraceType], 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.