# `causalis.scenarios.unconfoundedness.refutation.overlap.overlap_plot`

Plotting helpers for overlap diagnostics and propensity score geometry.

## Module Contents

### Functions

`plot_m_overlap` | Overlap plot for m(x)=P(D=1|X) with high-res rendering.

### API

causalis.scenarios.unconfoundedness.refutation.overlap.overlap_plot.plot_m_overlap(diag: Union[causalis.data_contracts.causal_diagnostic_data.UnconfoundednessDiagnosticData, causalis.data_contracts.causal_estimate.CausalEstimate, dict], clip: Tuple[float, float] = (0.01, 0.99), bins: Any = 'fd', kde: bool = True, shade_overlap: bool = True, ax: Optional[matplotlib.pyplot.Axes] = None, figsize: Tuple[float, float] = (9, 5.5), dpi: int = 220, font_scale: float = 1.15, save: Optional[str] = None, save_dpi: Optional[int] = None, transparent: bool = False, color_t: Optional[Any] = None, color_c: Optional[Any] = None) → matplotlib.pyplot.Figure

  Overlap plot for m(x)=P(D=1|X) with high-res rendering.

  - x in [0,1]

  - Stable NumPy KDE w/ boundary reflection (no SciPy warnings)

  - Uses Matplotlib default colors unless color_t/color_c are provided

  Parameters

  diag : UnconfoundednessDiagnosticData or CausalEstimate Diagnostic data directly, or an estimate containing diagnostic_data with m_hat and d. clip : tuple, default (0.01, 0.99) Quantiles to clip for KDE range. bins : str or int, default “fd” Histogram bins. kde : bool, default True Whether to show KDE. shade_overlap : bool, default True Whether to shade the overlap area. ax : matplotlib.axes.Axes, optional Existing axes to plot on. figsize : tuple, default (9, 5.5) Figure size. dpi : int, default 220 Dots per inch. font_scale : float, default 1.15 Font scaling factor. save : str, optional Path to save the figure. save_dpi : int, optional DPI for saving. transparent : bool, default False Whether to save with transparency. color_t : color, optional Color for treated group. color_c : color, optional Color for control group.

  Returns

  matplotlib.figure.Figure The generated figure.

  Notes

  This figure compares the treated and control distributions of :math:`m(X) = \mathbb{P}(D=1 \mid X)`. Good overlap means both groups place noticeable mass in the same regions of the unit interval. Clear separation or strong piling-up near `0` and `1` is a warning sign for unstable weighting.

  Examples

  > > > from sklearn.ensemble import RandomForestClassifier, RandomForestRegressor from causalis.dgp import obs_linear_26_dataset from causalis.scenarios.unconfoundedness.model import IRM data = obs_linear_26_dataset( … n=1000, … seed=3141, … include_oracle=False, … return_causal_data=True, … ) irm = IRM( … data=data, … ml_g=RandomForestRegressor( … n_estimators=200, … max_depth=6, … min_samples_leaf=5, … random_state=3141, … ), … ml_m=RandomForestClassifier( … n_estimators=200, … max_depth=6, … min_samples_leaf=5, … random_state=3141, … ), … n_folds=3, … random_state=3141, … ) estimate = irm.fit().estimate(score=”ATE”) fig = plot_m_overlap(estimate) # doctest: +SKIP