INNER CODE UNIT · Python
heatmap
widdowquinn/pyani · pyani/pyani_graphics/mpl/__init__.py:295
def heatmap(dfr, outfilename=None, title=None, params=None):
"""Return matplotlib heatmap with cluster dendrograms.
:param dfr: pandas DataFrame with relevant data
:param outfilename: path to output file (indicates output format)
:param params: a list of parameters for plotting: [colormap, vmin, vmax]
:param labels: dictionary of alternative labels, keyed by default sequence labels
:param classes: dictionary of sequence classes, keyed by default sequence labels
"""
# Sort rows by index - this ensures that labels match the dendrogram.
# When recovering dataframes from the database, we get row
# indexes/labels as integers, but out of order, resulting in a
# mismatch of labels to leaves in the dendrogram. This line remedies
# that.
dfr = dfr.sort_index()
# Layout figure grid and add title
# Set figure size by the number of rows in the dataframe