diff --git a/ausankey/ausankey.py b/ausankey/ausankey.py index 7eee1a4..4635543 100644 --- a/ausankey/ausankey.py +++ b/ausankey/ausankey.py @@ -636,13 +636,16 @@ def subplot(self, ii): # Draw node labels for lr in [0, 1] if ii == 0 else [1]: + + label_bool = ii + lr == 0 or ii + lr == self.num_flow or self.label_duplicate loc = self.label_loc[ii + lr] # inside labels, left if loc in ("left", "both"): xx = x_lr[lr] - self.x_label_gap + (lr - 1) * self.x_node_width for label in self.node_sizes[ii + lr]: - if (label not in self.node_sizes[ii]) or self.label_duplicate: + if label_bool or label not in self.node_sizes[ii]: + print(ii+lr,label_bool,"left") val = self.node_sizes[ii + lr][label] yy = self.node_pos_bot[ii][lr][label] + val / 2 self.draw_label(xx, yy, label, "right", val) @@ -651,7 +654,7 @@ def subplot(self, ii): if loc in ("center"): xx = x_lr[lr] + (2 * lr - 1) * self.x_node_width / 2 for label in self.node_sizes[ii + lr]: - if (label not in self.node_sizes[ii]) or self.label_duplicate: + if label_bool or label not in self.node_sizes[ii]: val = self.node_sizes[ii + lr][label] yy = self.node_pos_bot[ii][lr][label] + val / 2 self.draw_label(xx, yy, label, "center", val) @@ -660,7 +663,7 @@ def subplot(self, ii): if loc in ("top"): xx = x_lr[lr] + (2 * lr - 1) * self.x_node_width / 2 for label in self.node_sizes[ii + lr]: - if (label not in self.node_sizes[ii]) or self.label_duplicate: + if label_bool or label not in self.node_sizes[ii]: val = self.node_sizes[ii + lr][label] yy = self.node_pos_bot[ii][lr][label] + val + self.y_label_gap self.draw_label(xx, yy, label, "center", val) @@ -669,7 +672,8 @@ def subplot(self, ii): if loc in ("right", "both"): xx = x_lr[lr] + self.x_label_gap + lr * self.x_node_width for label in self.node_sizes[ii + lr]: - if (label not in self.node_sizes[ii]) or self.label_duplicate: + if label_bool or label not in self.node_sizes[ii]: + print(ii+lr,label_bool,"right") val = self.node_sizes[ii + lr][label] yy = self.node_pos_bot[ii][lr][label] + val / 2 self.draw_label(xx, yy, label, "left", val)