Stack Exchange
Plotting Minimum Distance within clusters and linkage distance between clusters
I using Hierarchical average-linkage method to do clustering using Euclidean distance. To find cluster number (k) to cut I need to do two plots one for Minimum Distance within clusters against number of cluster (graph 1) and one for linkage distance between clusters against number of cluster (graph 2). 
> df
     Site1 Site2 Site3 Site4 Site5 Site6
1985    11     0     5    15    13    15
1986    12    12     5    31    14    26
1987    23    21    17    14    25    12
1988    22    25    18    17    24    14
1989    11    16     8    18    13    19
1990     7     5    21     8     9    24
1991    20    13     9    21    22     7
1992    15    11     6    19    17    20
1993    19    18     9    11    21    11
1994    33     9    28    17    26    20
1995    16    14    19    33    17    10
1996    14    21    25     4     6    47
1997     4     0    11    22    14    16
1998    10    31    13    26    12    14
1999    24    17    18    41    19    20
2000    21    17    23    19    23    14
2001    12     8     6     7    19    20
2002    19    24    19    31    24    17
2003    13    29    10    28     7     9
2004    19    14    19    22    20    13
2005    16     8     9    10    11    13
2006     8     9    46     9    20    19
2007    12    10    15    13    10     9
2008    12    18    25    12    47    22
2009    19    18    18    23    21    20
2010    23    10    46    35    25    12
2011    20    35    18    30    22    18
2012    23    13    23    34    25    34
2013    17    28    20    13    19    21
2014    19    22    16    16    21    23

df2 <- data.frame(t(df))
tree <- hclust(dist(df2))


Since there's no question stated, I'm assuming that you are interested to plot the figure above with the example data-set. Please correct if I'm wrong with that assumption.
(i) find the number of groups based on sequence linkage distances. Sequence of linkage distance in this case was eyeballed from plot(tree):
library(dplyr)    
cls.df <- data.frame(h=40:100)
cls.df$k <- sapply(cls.df$h, function(x) cutree(tree, h=x) %>% max )

(ii) clean the table by retaining only the minimum linkages distance h for number of group k
cls.df <- cls.df %>% 
          group_by(k) %>% 
          summarise(h=min(h))

(iii) Plot:
library(ggplot2)
ggplot(cls.df, aes(k, h)) + 
   geom_line() + 
   geom_point() + 
   theme_bw() + 
   ylab("Linkage Distance") + 
   xlab("Number of Cluster")


