FAQ | This is a LIVE service | Changelog

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

created script for plotting similarity maps.

parent 7bc5c3af
No related branches found
No related tags found
No related merge requests found
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Script for plotting the similarity Matrix information as a graph, for
graphical comparison.
@author: mark
"""
import logging
import numpy as np
import matplotlib.pyplot as plt
import resultsanalysis.resultsoutput.plottinginput as plottinginput
logging.basicConfig()
LOGGER = logging.getLogger(__name__)
LOGGER.setLevel(logging.WARN)
def create_similarity_matrix(input_data, filename_stem, **kwargs):
"""This creates the similarity plot for the given data and outputs to file.
"""
simil_plot, simil_plot_axis = create_similarity_matrix(input_data, **kwargs)
fileformat = kwargs.get("fileformat", "eps")
output_filename = filename_stem + fileformat
plt.savefig(output_filename, format=fileformat)
plt.close(simil_plot)
def plot_similarity_matrix(input_data, **kwargs):
"""This creates the similarity plot for the given input data.
"""
simil_plot, simil_plot_axis = create_plot_with_axis(kwargs.get("figsize",
plottinginput.FIGURE_SIZES['similarity_matrix']))
mat_ax = simil_plot_axis.matshow(input_data["value_matrix"], interpolation="nearest")
simil_plot_axis.grid(True)
simil_plot_axis.xticks(range(len(input_data["labels"])), input_data["labels"])
simil_plot_axis.yticks(range(len(input_data["labels"])), input_data["labels"])
simil_plot.colorbar(mat_ax)
return simil_plot, simil_plot_axis
def create_plot_with_axis(figsize):
"""This creates the plot and axis.
"""
return plottinginput.create_plot_with_axis(figsize)
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