From c11973fdfc6608a77660d0776706d1fdbb8d9dc5 Mon Sep 17 00:00:00 2001
From: Mark Driver <mdd31@cam.ac.uk>
Date: Tue, 8 Aug 2017 20:38:51 +0100
Subject: [PATCH] modify threshold and add vertical line at threshold.

---
 solventmapcreator/clusteringanalysis/dendrogramplotting.py | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/solventmapcreator/clusteringanalysis/dendrogramplotting.py b/solventmapcreator/clusteringanalysis/dendrogramplotting.py
index 438e776..7547206 100644
--- a/solventmapcreator/clusteringanalysis/dendrogramplotting.py
+++ b/solventmapcreator/clusteringanalysis/dendrogramplotting.py
@@ -37,10 +37,13 @@ def create_dendogram(linkage_matrix, labels, figsize):
     """Creates a dendogram plot.
     """
     dendrogram_plot, dendrogram_plot_axis = create_plot_with_axis(figsize)
+    threshold = 0.4*max(linkage_matrix[:,2])
     cluster.dendrogram(linkage_matrix, labels=labels, orientation='right',
                        leaf_rotation=0, leaf_font_size=7,
+                       color_threshold=threshold,
                        ax=dendrogram_plot_axis)
     append_plot_labels(dendrogram_plot_axis)
+    dendrogram_plot_axis.axvline(x=threshold, c='k')
     return dendrogram_plot, dendrogram_plot_axis
 
 def append_plot_labels(plot_axis):
-- 
GitLab