diff --git a/CHANGELOG.md b/CHANGELOG.md index ae6716f..cf3d739 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/ausankey/ausankey.py b/ausankey/ausankey.py index d398731..b40947c 100644 --- a/ausankey/ausankey.py +++ b/ausankey/ausankey.py @@ -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"):