Skip to content
Submodule
causalis.shared.outcome_plots

outcome_plots

Submodule causalis.shared.outcome_plots with no child pages and 3 documented members.

Functions

Jump directly into the documented functions for this page.

3 items
function
causalis.shared.outcome_plots.outcome_plot_dist

outcome_plot_dist

Plot the distribution of the outcome for each treatment on a single, pretty plot.

Features

  • High-DPI canvas + scalable fonts

  • Default Matplotlib colors; KDE & mean lines match their histogram colors

  • Numeric outcomes: shared x-range (optional), optional KDE, quantile clipping

  • Categorical outcomes: normalized grouped bars by treatment

  • Binary outcomes: proportion bars with percent labels (no KDE)

  • Optional hi-res export (PNG/SVG/PDF)

Parameters

dataCausalData or MultiCausalData

The causal dataset containing the dataframe and metadata.

treatmentstr, optional

Treatment column name. For MultiCausalData, if not provided, one-hot treatment columns are converted to assigned treatment labels.

outcomestr, optional

Outcome column name. Defaults to the one in data_contracts.

binsstr or int, default “fd”

Number of bins for histograms (e.g., “fd”, “auto”, or an integer).

densitybool, default True

Whether to normalize histograms to form a density.

alphafloat, default 0.45

Transparency for overlaid histograms and bars.

sharexbool, default True

If True, use the same x-limits across treatments for numeric outcomes.

kdebool, default True

Whether to overlay a smooth density (KDE) for numeric outcomes.

cliptuple, optional, default (0.01, 0.99)

Quantiles to trim tails for nicer view of numeric outcomes.

figsizetuple, default (9, 5.5)

Figure size in inches (width, height).

dpiint, default 220

Dots per inch for the figure.

font_scalefloat, default 1.15

Scaling factor for all font sizes in the plot.

palettelist or dict, optional

Color palette for treatments (list in treatment order or dict {treatment: color}).

savestr, optional

Path to save the figure (e.g., “outcome.png”).

save_dpiint, optional

DPI for the saved figure. Defaults to 300 for raster formats.

transparentbool, default False

Whether to save the figure with a transparent background.

Returns

matplotlib.figure.Figure

The generated figure object.

Canonical target

causalis.shared.outcome_plots.outcome_plot_dist

Sections

FeaturesParametersReturns
Link to this symbol
function
causalis.shared.outcome_plots.outcome_plot_boxplot

outcome_plot_boxplot

Prettified boxplot of the outcome by treatment.

Features

  • High-DPI figure, scalable fonts

  • Soft modern color styling (default Matplotlib palette)

  • Optional outliers, gentle transparency

  • Optional save to PNG/SVG/PDF

Parameters

dataCausalData or MultiCausalData

The causal dataset containing the dataframe and metadata.

treatmentstr, optional

Treatment column name. For MultiCausalData, if not provided, one-hot treatment columns are converted to assigned treatment labels.

outcomestr, optional

Outcome column name. Defaults to the one in data_contracts.

figsizetuple, default (9, 5.5)

Figure size in inches (width, height).

dpiint, default 220

Dots per inch for the figure.

font_scalefloat, default 1.15

Scaling factor for all font sizes in the plot.

showfliersbool, default True

Whether to show outliers (fliers).

patch_artistbool, default True

Whether to fill boxes with color.

palettelist or dict, optional

Color palette for treatments (list in treatment order or dict {treatment: color}).

savestr, optional

Path to save the figure (e.g., “boxplot.png”).

save_dpiint, optional

DPI for the saved figure. Defaults to 300 for raster formats.

transparentbool, default False

Whether to save the figure with a transparent background.

Returns

matplotlib.figure.Figure

The generated figure object.

Canonical target

causalis.shared.outcome_plots.outcome_plot_boxplot

Sections

FeaturesParametersReturns
Link to this symbol
function
causalis.shared.outcome_plots.outcome_plots

outcome_plots

Plot the distribution of the outcome for every treatment on one plot, and also produce a boxplot by treatment to visualize outliers.

Parameters

dataCausalData or MultiCausalData

The causal dataset containing the dataframe and metadata.

treatmentstr, optional

Treatment column name. Defaults to the one in data_contracts.

outcomestr, optional

Outcome column name. Defaults to the one in data_contracts.

binsint, default 30

Number of bins for histograms when the outcome is numeric.

densitybool, default True

Whether to normalize histograms to form a density.

alphafloat, default 0.5

Transparency for overlaid histograms.

figsizetuple, default (7, 4)

Figure size for the plots (width, height).

sharexbool, default True

If True and the outcome is numeric, use the same x-limits across treatments.

palettelist or dict, optional

Color palette for treatments (list in treatment order or dict {treatment: color}).

Returns

Tuple[matplotlib.figure.Figure, matplotlib.figure.Figure]

(fig_distribution, fig_boxplot)

Canonical target

causalis.shared.outcome_plots.outcome_plots

Sections

ParametersReturns
Link to this symbol