Skip to content

Commit

Permalink
fixed a bug where topEdge was not set in _get_positions_and_total_wid…
Browse files Browse the repository at this point in the history
…ths (#45)
  • Loading branch information
KukumavMozolo authored Jun 14, 2024
1 parent b06fc3f commit 4550755
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pysankey/sankey/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 5 additions & 0 deletions tests/test_sankey.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

0 comments on commit 4550755

Please sign in to comment.