diff --git a/pysankey/sankey/__init__.py b/pysankey/sankey/__init__.py index 17a5ed9..fe0a4e6 100644 --- a/pysankey/sankey/__init__.py +++ b/pysankey/sankey/__init__.py @@ -493,7 +493,7 @@ def _get_positions_and_total_widths( weighted_sum = 0.02 * df[side + "Weight"].sum() label_widths["bottom"] = bottom_width + weighted_sum label_widths["top"] = label_widths["bottom"] + label_widths[side] - topEdge = label_widths["top"] + topEdge = label_widths["top"] widths[label] = label_widths LOGGER.debug("%s position of '%s' : %s", side, label, label_widths) # pylint: disable-next=possibly-used-before-assignment diff --git a/tests/test_sankey.py b/tests/test_sankey.py index c9670b7..77c316b 100644 --- a/tests/test_sankey.py +++ b/tests/test_sankey.py @@ -8,3 +8,8 @@ class TestSankey(TestFruit): def test_right_color(self) -> None: ax = sankey(self.data["true"], self.data["predicted"], rightColor=True) self.assertIsInstance(ax, plt.Axes) + + def test_single(self) -> None: + source = [1] + target = [2] + sankey(source, target, rightColor=True)