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']) – Seaborn style (‘whitegrid’, ‘darkgrid’, ‘white’, ‘dark’, ‘ticks’)

  • context (Literal['paper', 'notebook', 'talk', 'poster']) – Seaborn context (‘paper’, ‘notebook’, ‘talk’, ‘poster’)

  • figsize (tuple[int, int]) – Default figure size (width, height)

  • dpi (int) – DPI for rasterized output

close_all()[source]

Close all open figures.

Return type:

None

plot_bivariate(data, var1, var2, output_path=None, return_metadata=False)[source]

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

Return type:

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

Returns:

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

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

Return type:

Figure

Returns:

Matplotlib figure

plot_univariate(data, variable, output_path=None, return_metadata=False)[source]

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

Return type:

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

Returns:

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

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