pyani.pyani_graphics.mpl package

Module contents

Code to implement MatPLotLib graphics output for ANI analyses.

pyani.pyani_graphics.mpl.add_colorbar(dfr, fig, dend, params, orientation='row')[source]

Add class colorbars to Matplotlib heatmap.

Parameters:
  • dfr
  • fig
  • dent
  • params
  • orientation
pyani.pyani_graphics.mpl.add_colorscale(fig, heatmap_gs, ax_map, params, title=None)[source]

Add colour scale to heatmap.

Parameters:
  • fig
  • heatmap_gs
  • ax_map
  • params
  • title
pyani.pyani_graphics.mpl.add_dendrogram(dfr, fig, params, heatmap_gs, orientation='col')[source]

Return a dendrogram and corresponding gridspec, attached to the fig.

Parameters:
  • dfr – Pandas DataFrame describing input data
  • fig – matplotlib Fig that holds graphical output
  • params – pyani_graphics.Params object
  • heatmap_gs – matplotlib GridSpec for this dendrogram
  • 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

pyani.pyani_graphics.mpl.add_labels(heatmap_axes, rowlabels, collabels, params)[source]

Add labels to Matplotlib heatmap axes, in-place.

Parameters:
  • heatmap_axes
  • rowlabels
  • collabels
  • params
pyani.pyani_graphics.mpl.clean_axis(axis)[source]

Remove ticks, tick labels, and frame from axis.

Parameters:axis
pyani.pyani_graphics.mpl.distribution(dfr, outfilename, matname, title=None)[source]

Return matplotlib distribution plot for matrix.

Parameters:
  • dfr – DataFrame with results matrix
  • outfilename – Path to output file for writing
  • matname – str, type of matrix being plotted
  • title – str, optional title
pyani.pyani_graphics.mpl.get_heatmap_axes(dfr, fig, heatmap_gs)[source]

Return axis for Matplotlib heatmap.

Parameters:
  • dfr
  • fig
  • heatmap_gs
pyani.pyani_graphics.mpl.heatmap(dfr, outfilename=None, title=None, params=None)[source]

Return matplotlib heatmap with cluster dendrograms.

Parameters:
  • dfr – pandas DataFrame with relevant data
  • outfilename – path to output file (indicates output format)
  • params – a list of parameters for plotting: [colormap, vmin, vmax]
  • labels – dictionary of alternative labels, keyed by default sequence labels
  • classes – dictionary of sequence classes, keyed by default sequence labels
pyani.pyani_graphics.mpl.scatter(dfr1, dfr2, outfilename=None, matname1='identity', matname2='coverage', title=None, params=None)[source]

Return matplotlib scatterplot.

Parameters:
  • dfr1 – pandas DataFrame with x-axis data
  • dfr2 – pandas DataFrame with y-axis data
  • outfilename – path to output file (indicates output format)
  • matname1 – name of x-axis data
  • matname2 – name of y-axis data
  • title – title for the plot
  • params – a list of parameters for plotting: [colormap, vmin, vmax]