Skip to content

Commit be01357

Browse files
committed
revert to simpler plot titles
1 parent 7b473af commit be01357

File tree

2 files changed

+8
-9
lines changed

2 files changed

+8
-9
lines changed

causalpy/experiments/synthetic_control.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -266,10 +266,10 @@ def _bayesian_plot(
266266
self.datapre.index,
267267
self.datapre_treated.sel(treated_units=primary_unit_name),
268268
"k.",
269-
label=f"Observations ({primary_unit_name})",
269+
label="Observations",
270270
)
271271
handles.append(h)
272-
labels.append(f"Observations ({primary_unit_name})")
272+
labels.append("Observations")
273273

274274
# post intervention period
275275
h_line, h_patch = plot_xY(
@@ -298,7 +298,7 @@ def _bayesian_plot(
298298
handles.append(h)
299299
labels.append("Causal impact")
300300

301-
ax[0].set(title=f"{self._get_score_title(round_to)}\nUnit: {primary_unit_name}")
301+
ax[0].set(title=f"{self._get_score_title(round_to)}\nUnit")
302302

303303
# MIDDLE PLOT -----------------------------------------------
304304
plot_xY(
@@ -323,10 +323,10 @@ def _bayesian_plot(
323323
alpha=0.25,
324324
label="Causal impact",
325325
)
326-
ax[1].set(title=f"Causal Impact ({primary_unit_name})")
326+
ax[1].set(title="Causal Impact")
327327

328328
# BOTTOM PLOT -----------------------------------------------
329-
ax[2].set(title=f"Cumulative Causal Impact ({primary_unit_name})")
329+
ax[2].set(title="Cumulative Causal Impact")
330330
plot_xY(
331331
self.datapost.index,
332332
self.post_impact_cumulative.sel(treated_units=primary_unit_name),
@@ -415,7 +415,7 @@ def _ols_plot(
415415
ls=":",
416416
c="k",
417417
)
418-
ax[0].set(title=f"{self._get_score_title(round_to)}\nUnit: {primary_unit_name}")
418+
ax[0].set(title=f"{self._get_score_title(round_to)}\nUnit")
419419
# Shaded causal effect - handle different prediction formats
420420
try:
421421
# For OLS, predictions might be simple arrays
@@ -451,11 +451,11 @@ def _ols_plot(
451451
label=counterfactual_label,
452452
)
453453
ax[1].axhline(y=0, c="k")
454-
ax[1].set(title=f"Causal Impact ({primary_unit_name})")
454+
ax[1].set(title="Causal Impact")
455455

456456
ax[2].plot(self.datapost.index, self.post_impact_cumulative, c="k")
457457
ax[2].axhline(y=0, c="k")
458-
ax[2].set(title=f"Cumulative Causal Impact ({primary_unit_name})")
458+
ax[2].set(title="Cumulative Causal Impact")
459459

460460
# Shaded causal effect
461461
ax[1].fill_between(

causalpy/tests/test_multi_unit_sc.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,6 @@ def test_multi_unit_plotting(self, multi_unit_sc_data):
246246
assert (
247247
"R²" in title or "R^2" in title
248248
) # Score information should be displayed
249-
assert "Unit:" in title # Unit information should be displayed
250249

251250
def test_multi_unit_plot_data(self, multi_unit_sc_data):
252251
"""Test that plot data generation works with multiple treated units."""

0 commit comments

Comments
 (0)