Skip to content

Commit 14ff36c

Browse files
authored
Merge pull request #222 from igerber/enhanced-visualizations
Add enhanced visualizations with plotly backend
2 parents 6454bd6 + 8a40af6 commit 14ff36c

17 files changed

Lines changed: 5374 additions & 1767 deletions

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
### Added
11+
- Refactor `visualization.py` into `visualization/` subpackage for better organization
12+
- Add `plot_synth_weights()` — bar chart of Synthetic DiD unit/time weights
13+
- Add `plot_staircase()` — treatment adoption visualization for staggered designs
14+
- Add `plot_dose_response()` — dose-response curve for Continuous DiD
15+
- Add `plot_group_time_heatmap()` — heatmap of ATT(g,t) from staggered estimators
16+
- Add interactive plotly backend (`backend="plotly"`) for all visualization functions
17+
- Add `plotly` optional dependency group (`pip install diff-diff[plotly]`)
18+
1019
## [2.7.4] - 2026-03-21
1120

1221
### Added

TODO.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ Deferred items from PR reviews that were not addressed before merge.
6969
| R comparison tests spawn separate `Rscript` per test (slow CI) | `tests/test_methodology_twfe.py:294` | #139 | Low |
7070
| CS R helpers hard-code `xformla = ~ 1`; no covariate-adjusted R benchmark for IRLS path | `tests/test_methodology_callaway.py` | #202 | Low |
7171
| ~376 `duplicate object description` Sphinx warnings — caused by autodoc `:members:` on dataclass attributes within manual API pages (not from autosummary stubs); fix requires restructuring `docs/api/*.rst` pages to avoid documenting the same attribute via both `:members:` and inline `autosummary` tables | `docs/api/*.rst` || Low |
72+
| Plotly renderers silently ignore styling kwargs (marker, markersize, linewidth, capsize, ci_linewidth) that the matplotlib backend honors; thread them through or reject when `backend="plotly"` | `visualization/_event_study.py`, `_diagnostic.py`, `_power.py` | #222 | Medium |
7273

7374
---
7475

diff_diff/__init__.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -155,12 +155,16 @@
155155
)
156156
from diff_diff.visualization import (
157157
plot_bacon,
158+
plot_dose_response,
158159
plot_event_study,
159160
plot_group_effects,
161+
plot_group_time_heatmap,
160162
plot_honest_event_study,
161163
plot_power_curve,
162164
plot_pretrends_power,
163165
plot_sensitivity,
166+
plot_staircase,
167+
plot_synth_weights,
164168
)
165169
from diff_diff.datasets import (
166170
clear_cache,
@@ -220,7 +224,6 @@
220224
"BaconDecompositionResults",
221225
"Comparison2x2",
222226
"bacon_decompose",
223-
"plot_bacon",
224227
# Results
225228
"DiDResults",
226229
"MultiPeriodDiDResults",
@@ -251,10 +254,17 @@
251254
"EDiDBootstrapResults",
252255
"EDiD",
253256
# Visualization
257+
"plot_bacon",
254258
"plot_event_study",
255259
"plot_group_effects",
256260
"plot_sensitivity",
257261
"plot_honest_event_study",
262+
"plot_power_curve",
263+
"plot_pretrends_power",
264+
"plot_synth_weights",
265+
"plot_staircase",
266+
"plot_dose_response",
267+
"plot_group_time_heatmap",
258268
# Parallel trends testing
259269
"check_parallel_trends",
260270
"check_parallel_trends_robust",
@@ -308,14 +318,12 @@
308318
"simulate_mde",
309319
"simulate_power",
310320
"simulate_sample_size",
311-
"plot_power_curve",
312321
# Pre-trends power analysis
313322
"PreTrendsPower",
314323
"PreTrendsPowerResults",
315324
"PreTrendsPowerCurve",
316325
"compute_pretrends_power",
317326
"compute_mdv",
318-
"plot_pretrends_power",
319327
# Survey support
320328
"SurveyDesign",
321329
"SurveyMetadata",

0 commit comments

Comments
 (0)