INNER CODE UNIT · Python
add_dendrogram
widdowquinn/pyani · pyani/pyani_graphics/mpl/__init__.py:84
def add_dendrogram(dfr, fig, params, heatmap_gs, orientation="col"):
"""Return a dendrogram and corresponding gridspec, attached to the fig.
:param dfr: Pandas DataFrame describing input data
:param fig: matplotlib Fig that holds graphical output
:param params: pyani_graphics.Params object
:param heatmap_gs: matplotlib GridSpec for this dendrogram
:param orientation: str, "row" or "col"
Modifies the fig in-place. Orientation is either 'row' or 'col' and
determines location and orientation of the rendered dendrogram.
We expect that the row/column index values should be ordered
identically. If they are not, the dendrogram will not match labels
"""
# Row or column axes?
if orientation == "row":
dists = distance.pdist(dfr)