API ReferenceEntry

outcome_plot_dist

outcome_plot_dist

Reference details for outcome_plot_dist in causalis.shared.

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
  • data (CausalData or MultiCausalData) – The causal dataset containing the dataframe and metadata.
  • treatment (str) – Treatment column name. For MultiCausalData, if not provided, one-hot treatment columns are converted to assigned treatment labels.
  • outcome (str) – Outcome column name. Defaults to the one in data_contracts.
  • bins (str or int) – Number of bins for histograms (e.g., "fd", "auto", or an integer).
  • density (bool) – Whether to normalize histograms to form a density.
  • alpha (float) – Transparency for overlaid histograms and bars.
  • sharex (bool) – If True, use the same x-limits across treatments for numeric outcomes.
  • kde (bool) – Whether to overlay a smooth density (KDE) for numeric outcomes.
  • clip (tuple) – Quantiles to trim tails for nicer view of numeric outcomes.
  • figsize (tuple) – Figure size in inches (width, height).
  • dpi (int) – Dots per inch for the figure.
  • font_scale (float) – Scaling factor for all font sizes in the plot.
  • palette (list or dict) – Color palette for treatments (list in treatment order or dict {treatment: color}).
  • save (str) – Path to save the figure (e.g., "outcome.png").
  • save_dpi (int) – DPI for the saved figure. Defaults to 300 for raster formats.
  • transparent (bool) – Whether to save the figure with a transparent background.
Returns
  • Figure – The generated figure object.