FAQ | This is a LIVE service | Changelog

Skip to content
Snippets Groups Projects
Commit 681c3f3f authored by M.D. Driver's avatar M.D. Driver
Browse files

continued on the dendrogram plotting methods.

parent 0c1a3aaf
No related branches found
No related tags found
No related merge requests found
......@@ -16,11 +16,37 @@ logging.basicConfig()
LOGGER = logging.getLogger(__name__)
LOGGER.setLevel(logging.WARN)
def create_and_write_dendogram(linkage_matrix, labels, filename_stem, **kwargs):
"""This creates a dendogram plot and writesto file.
"""
dendrogram_plot, dendrogram_plot_axis = create_dendogram(linkage_matrix, labels,
kwargs.get("figsize",(15,20)))
append_plot_labels(dendrogram_plot_axis)
fileformat = kwargs.get("fileformat", "eps")
output_filename = create_outputfilename(filename_stem, fileformat)
plt.savefig(output_filename, format=fileformat)
plt.close(dendrogram_plot)
return 0
def create_outputfilename(filename_stem, fileformat):
"""This creates a
"""
return plottinginput.create_output_filename_from_stem(filename_stem, fileformat)
def create_dendogram(linkage_matrix, labels, figsize):
"""Creates a
"""Creates a dendogram plot.
"""
dendrogram_plot, dendrogram_plot_axis = create_plot_with_axis(figsize)
cluster.dendrogram(linkage_matrix, labels=labels, ax=dendrogram_plot_axis)
cluster.dendrogram(linkage_matrix, labels=labels, leaf_rotation=90, leaf_font_size=8,
ax=dendrogram_plot_axis)
append_plot_labels(dendrogram_plot_axis)
return dendrogram_plot, dendrogram_plot_axis
def append_plot_labels(plot_axis):
"""This adds labels to the dendrogram axis.
"""
plot_axis.set_xlabel("Solvent")
plot_axis.set_ylabel(r"Distance/kJmol^{-1}")
def create_plot_with_axis(figsize):
"""Function creates plot and plot axis.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment