title: How to access the x axis index of a scipy denogram?
body: <p>I have data, for which I create a linkage model, like this:</p>
  
  <pre><code>model = sc.linkage(data, 'ward')
  </code></pre>
  
  <p>Where model is as follows:</p>
  
  <pre><code>Z = np.array([
     [  2.        ,   9.        ,  20.12172148,   2.        ],
     [  0.        ,   1.        ,  26.16772232,   2.        ],
     [ 11.        ,  12.        ,  29.40258214,   2.        ],
     [ 14.        ,  16.        ,  30.89332011,   3.        ],
     [  3.        ,   7.        ,  33.70695832,   2.        ],
     [  5.        ,  13.        ,  34.22180543,   2.        ],
     [  4.        ,  15.        ,  35.52080322,   3.        ],
     [ 17.        ,  21.        ,  45.3919152 ,   5.        ],
     [  6.        ,  20.        ,  45.56339627,   3.        ],
     [  8.        ,  23.        ,  66.42828305,   4.        ],
     [ 10.        ,  22.        ,  87.52531145,   6.        ],
     [ 18.        ,  24.        ,  93.78070161,   7.        ],
     [ 19.        ,  26.        , 124.09967826,   9.        ],
     [ 25.        ,  27.        , 160.11685636,  15.        ]])
     Z == model # returns true
  </code></pre>
  
  <p>I can then plot  this linkage model using <code>matplotlib</code>:</p>
  
  <pre><code># calculate full dendrogram
  plt.figure(figsize=(25, 10))
  plt.title('Hierarchical Clustering Dendrogram for signature data')
  plt.xlabel('sample index')
  plt.ylabel('distance')
  sc.dendrogram(
      model,
      leaf_rotation=90.,  # rotates the x axis labels
      leaf_font_size=8.,  # font size for the x axis labels
  )
  plt.show()
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/NhBhY.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/NhBhY.png" alt="enter image description here"></a></p>
  
  <p>Now, this plots the dendogram and sets the xticks to the index. I would want to replace this with actual labels, which are</p>
  
  <pre><code>labels = ['wood', 'stone', 'flora', 'liquid', 'food', 'metal', 'ceramic', 
            'sky', 'glass', 'paper', 'animal', 'skin', 'fabrics', 'gem', 'ground']
  </code></pre>
  
  <p>as in, the first tick on the x-axis reads 10. Which would be labels[10]. However, I can't find out how to access this index.</p>