Visualization

Statistical plotting and visualization utilities.

Plots

Publication-quality plot generation with metadata support.

Plotting utilities for statistical visualizations.

Creates publication-quality plots for insights.

class statqa.visualization.plots.PlotFactory(style='whitegrid', context='notebook', figsize=(8, 6), dpi=100)[source]

Bases: object

Factory for creating statistical visualizations.

Parameters:
  • style (Literal['whitegrid', 'darkgrid', 'white', 'dark', 'ticks'])

  • context (Literal['paper', 'notebook', 'talk', 'poster'])

  • figsize (tuple[int, int])

  • dpi (int)

plot_univariate(data: Series, variable: Variable, output_path: str | Path | None = None, *, return_metadata: Literal[False] = False) Figure[source]
plot_univariate(data: Series, variable: Variable, output_path: str | Path | None = None, *, return_metadata: Literal[True]) tuple[Figure, dict[str, Any]]

Create univariate plot (histogram or bar chart).

Parameters:
  • data (Series) – Data series

  • variable (Variable) – Variable metadata

  • output_path (str | Path | None) – Optional path to save plot

  • return_metadata (bool) – Whether to return plot metadata alongside figure

Returns:

Matplotlib figure, or tuple of (figure, metadata) if return_metadata=True

Return type:

Figure | tuple[Figure, dict[str, Any]]

plot_bivariate(data: DataFrame, var1: Variable, var2: Variable, output_path: str | Path | None = None, *, return_metadata: Literal[False] = False) Figure[source]
plot_bivariate(data: DataFrame, var1: Variable, var2: Variable, output_path: str | Path | None = None, *, return_metadata: Literal[True]) tuple[Figure, dict[str, Any]]

Create bivariate plot (scatter, box, or heatmap).

Parameters:
  • data (DataFrame) – DataFrame with both variables

  • var1 (Variable) – First variable

  • var2 (Variable) – Second variable

  • output_path (str | Path | None) – Optional path to save plot

  • return_metadata (bool) – Whether to return plot metadata alongside figure

Returns:

Matplotlib figure, or tuple of (figure, metadata) if return_metadata=True

Return type:

Figure | tuple[Figure, dict[str, Any]]

plot_temporal(data, time_var, value_var, group_var=None, output_path=None)[source]

Create temporal trend plot.

Parameters:
  • data (DataFrame) – DataFrame with time and value

  • time_var (Variable) – Time variable

  • value_var (Variable) – Value variable

  • group_var (Variable | None) – Optional grouping variable

  • output_path (str | Path | None) – Optional path to save plot

Returns:

Matplotlib figure

Return type:

Figure

close_all()[source]

Close all open figures.

Return type:

None

Themes

Matplotlib/Seaborn theme configuration.

Consistent theming for visualizations.

statqa.visualization.themes.setup_theme(style='publication')[source]

Set up matplotlib/seaborn theme.

Parameters:

style (Literal['publication', 'presentation', 'notebook']) – Theme style (‘publication’, ‘presentation’, ‘notebook’)

Raises:

ValueError – If style is not supported

Return type:

None