dml-plotting
dml-plotting provides lightweight plotting utilities for comparing event-study
estimates across estimators, including support for publication-style line plots
with optional confidence bands.
Install
pip install dml-plotting
Quick Start
from dml_plotting import example_event_study_input, plot_event_study
plot_event_study(
example_event_study_input(),
output_path="event_study.png",
title="ERA pooled ATT event-study estimates across estimators",
y_limits=(0.05, 0.05),
)
To add confidence bands and a caption:
from dml_plotting import example_event_study_input, plot_event_study
plot_event_study(
example_event_study_input(),
output_path="event_study_with_ci.png",
title="ERA pooled ATT event-study estimates across estimators",
caption="Confidence bands show 95 percent intervals around each series.",
show_confidence_bands=True,
y_limits=(0.05, 0.05),
)
Control-Group Size Plotter
Use ControlGroupSizePoint for each observed run, then pass three cumulative
covariate panels to plot_control_group_size_tradeoffs_grid(). The control
group sample-size axis is log-scaled and defaults to running from 1,000 through
1 billion people.
from dml_plotting import (
ControlGroupSizePanel,
ControlGroupSizePoint,
SQRT_ASYMPTOTIC,
XLOGX,
plot_control_group_size_tradeoffs_grid,
)
fit_specs = {
"runtime_minutes": XLOGX,
"outcome_mse": XLOGX,
"pooled_att_estimate": SQRT_ASYMPTOTIC,
}
basic_points = [
ControlGroupSizePoint(20, outcome_mse=0.99, runtime_minutes=3.2, pooled_att_estimate=-2900),
ControlGroupSizePoint(40, outcome_mse=0.81, runtime_minutes=7.4, pooled_att_estimate=-1850),
ControlGroupSizePoint(80, outcome_mse=0.65, runtime_minutes=17.5, pooled_att_estimate=-950),
]
panels = [
ControlGroupSizePanel("Basic covariates", basic_points, feature_count=42, fit_specs=fit_specs),
ControlGroupSizePanel("Basic + county indicators", basic_points, feature_count=96, fit_specs=fit_specs),
ControlGroupSizePanel("Basic + county + tract characteristics", basic_points, feature_count=178, fit_specs=fit_specs),
]
plot_control_group_size_tradeoffs_grid(
panels,
output_path="control_group_size_grid.png",
title="DoubleML runtime and performance: Low-complexity LightGBM models on ERA data",
footnote="LightGBM parameters: num_leaves=31, learning_rate=0.05, n_estimators=250.",
x_limits=(1_000, 100_000_000),
show_fit_lines={"outcome_mse": False},
y_axis_limits={
"runtime_minutes": (0, 600),
"outcome_mse": (0.4, 1.05),
"pooled_att_estimate": (-3200, 100),
},
)
colors and show_fit_lines accept any subset of runtime_minutes,
outcome_mse, and pooled_att_estimate. By default, runtime uses OI navy,
outcome-model MSE uses OI red, and pooled ATT uses OI blue.
For a quick smoke test with bundled example data:
python -m dml_plotting.examples
This writes example images to dist/control_group_size_plot_examples/.
The former aipw_analysis import path is still available as a compatibility
alias in this package.
Public API
EventStudySeries: dataclass for one event-study seriesplot_event_study(): save a multi-series event-study figureControlGroupSizePoint: dataclass for one runtime/performance runControlGroupSizePanel: dataclass for one covariate-specification panelplot_control_group_size_tradeoffs_grid(): save the 2x3 control-group-size figureexample_event_study_input(): generate example plotting inputs
Development
source .venv/bin/activate
python -m pip install -e . --no-build-isolation
python -m build --no-isolation
python -m twine check dist/*
Publishing
This repo includes GitHub Actions trusted publishing in
.github/workflows/publish.yml. Publishing is triggered by pushing a tag like:
git tag v0.1.5
git push origin v0.1.5
Metadata
Release files for dml-plotting 0.1.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| dml_plotting-0.1.6.tar.gz | 16.0 kB | With provenance | Details for dml_plotting-0.1.6.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| dml_plotting-0.1.6-py3-none-any.whl | Python 3 | none | any | Details for dml_plotting-0.1.6-py3-none-any.whl |
Total release size: 32.0 kB
Release files / dml_plotting-0.1.6.tar.gz
| Download URL | dml_plotting-0.1.6.tar.gz |
|---|---|
| Size | 16.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7ffad8e6e0b0954dae903eaad14821fabbaf90285cb1038e079a06f4be2d5570
|
|
BLAKE2b-256 checksum How to use checksums |
e6872db2d1289ad0f437deb646383aa4cbbf0a741a19eaf5da75e3f0640e26e2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Apr 28, 2026.
Transparency logRelease files / dml_plotting-0.1.6-py3-none-any.whl
| Download URL | dml_plotting-0.1.6-py3-none-any.whl |
|---|---|
| Size | 16.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9eeed3137fb354a226bd5e3548aeffdebb6b8ac9bf5a69974cf303a75f8622ad
|
|
BLAKE2b-256 checksum How to use checksums |
05b5199af53626c7ed54885aa2197be86011ced077bafab0a516f4ec03e49344
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Apr 28, 2026.
Transparency logSecurity for dml-plotting 0.1.6
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for dml_plotting-0.1.6.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Apr 28, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.