Skip to content

Commit 6901cd8

Browse files
PauBadiaMclaude
andcommitted
Fix dotplot vcenter=0 being ignored due to falsy check
`if vcenter:` evaluates to False when vcenter=0, so TwoSlopeNorm was never applied. Changed to `if vcenter is not None:` and added vcenter=0 to the parametrized test. Closes #293 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 6249825 commit 6901cd8

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

src/decoupler/pl/_dotplot.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ def dotplot(
102102
# Plot
103103
ns = (s_vals * scale * plt.rcParams["lines.markersize"]) ** 2
104104
bp.ax.grid(axis="x")
105-
if vcenter:
105+
if vcenter is not None:
106106
norm = TwoSlopeNorm(vmin=None, vcenter=vcenter, vmax=None)
107107
else:
108108
norm = None

tests/pl/test_dotplot.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ def df():
2020
return df
2121

2222

23-
@pytest.mark.parametrize("vcenter", [None, 3])
23+
@pytest.mark.parametrize("vcenter", [None, 0, 3])
2424
def test_dotplot(
2525
df,
2626
vcenter,

0 commit comments

Comments
 (0)