diff --git a/gneiss/plot/_heatmap.py b/gneiss/plot/_heatmap.py index 4491441..afb6878 100644 --- a/gneiss/plot/_heatmap.py +++ b/gneiss/plot/_heatmap.py @@ -169,6 +169,7 @@ def _plot_highlights_dendrogram(ax_highlights, table, t, highlights): hcoords = [] for i, n in enumerate(highlights.index): node = t.find(n) + k, l, r = node._k, node._l, node._r ax_highlights.add_patch( diff --git a/gneiss/plot/_plot.py b/gneiss/plot/_plot.py index 1a307c1..c357603 100644 --- a/gneiss/plot/_plot.py +++ b/gneiss/plot/_plot.py @@ -451,7 +451,8 @@ def dendrogram_heatmap(output_dir: str, table: pd.DataFrame, tree: TreeNode, metadata: MetadataCategory, ndim=10, method='clr', color_map='viridis'): - nodes = [n.name for n in tree.levelorder()] + nodes = [n.name for n in tree.levelorder() if not n.is_tip()] + nlen = min(ndim, len(nodes)) highlights = pd.DataFrame([['#00FF00', '#FF0000']] * nlen, index=nodes[:nlen]) diff --git a/gneiss/plot/tests/test_plot.py b/gneiss/plot/tests/test_plot.py index 396cb53..0ed6273 100644 --- a/gneiss/plot/tests/test_plot.py +++ b/gneiss/plot/tests/test_plot.py @@ -317,6 +317,36 @@ def test_visualization(self): self.assertIn('