Skip to content

Commit

Permalink
fix title alignment bug
Browse files Browse the repository at this point in the history
  • Loading branch information
wspr committed May 29, 2024
1 parent b742bfc commit 357d70f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
# Changelog for ausankey


## 2024-05-29 v1.4

* Fix alignment bug when nodes were changing their
label and stopping/starting.
* Fix title alignment bug when second-to-last and
last stages had different nodes on top.
* Add `top` option for `label_loc`.
* Start a doc page to collate some examples.
* Substantial code refactoring (which I sometimes
Expand Down
4 changes: 2 additions & 2 deletions ausankey/ausankey.py
Original file line number Diff line number Diff line change
Expand Up @@ -716,15 +716,15 @@ def plot_titles(self, ii):

x_lr = self.x_lr[ii]

last_label = self.node_pairs[ii][-1]
title_x = [x_lr[0] - self.x_node_width / 2, x_lr[1] + self.x_node_width / 2]

for lr in [0, 1] if ii == 0 else [1]:
last_label = list(self.node_sizes[ii + lr])[-1]
if self.title_side in ("top", "both"):
if self.title_loc == "outer":
yt = min(self.voffset) + self.y_title_gap + self.y_frame_gap + self.plot_height
elif self.title_loc == "inner":
yt = self.y_title_gap + self.node_pos_top[ii][lr][last_label[lr]]
yt = self.y_title_gap + self.node_pos_top[ii][lr][last_label]
self.draw_title(title_x[lr], yt, self.titles[ii + lr], "bottom")

if self.title_side in ("bottom", "both"):
Expand Down

0 comments on commit 357d70f

Please sign in to comment.