# Path: PyContact/core/Biochemistry.py
# class AccumulationMapIndex:
#     """Enum and mapping for atom properties.
#        Used to dynamically define keys and have a bijective nomenclature for all properties
#     """
#     index, name, resid, resname, segid = range(5)
#     mapping = ["i.", "nm.", "r.", "rn.", "s."]
#     vmdsel = ["index", "name", "resid", "resname", "segname"]


from PyQt5.QtWidgets import QSizePolicy, QApplication
from math import factorial
from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg \
    as FigureCanvas
from matplotlib.figure import Figure
from matplotlib import cm
from matplotlib import animation as ani
from ..core.ContactFilters import *
from ..core.Biochemistry import AccumulationMapIndex
from matplotlib import pyplot as plt
import numpy as np
import matplotlib
import seaborn as sns
                values.append(c.median_life_time(nsPerFrame, threshold))
                titles.append(c.title)
        elif attribute == "Hbond percentage":
            for c in currentContacts:
                values.append(c.hbond_percentage())
                titles.append(c.title)

        valuesNp = np.array(values, dtype=float)
        titlesNp = np.array(titles, dtype=str)

        x = range(len(currentContacts))
        # h = self.axes.bar(x, valuesNp, color="red")
        h = self.axes.bar(x, valuesNp)
        xticks_pos = [0.7071 * patch.get_width() + patch.get_xy()[0] for patch in h]
        self.axes.set_xticklabels(titlesNp, ha='right', size=8, rotation=45)
        self.axes.set_xticks(xticks_pos)
        for tick in self.axes.xaxis.get_major_ticks():
            tick.label.set_fontsize(xticksfontsize)
        self.axes.set_ylabel(attribute)
        self.fig.subplots_adjust(bottom=0.2, top=0.95, left=0.1, right=0.9)

    def saveFigure(self, path, outputFormat):
        self.fig.savefig(path + "." + outputFormat, format=outputFormat)


class MapPlotter(MplPlotter):
    """Simple canvas with an 2d heatmap plot."""
    def plotMap(self, contacts, map1, map2, label1, label2, attribute, threshold, nsPerFrame):
        minmaxresids1 = []
        minmaxresids2 = []

# Path: PyContact/core/Biochemistry.py
# class AccumulationMapIndex:
#     """Enum and mapping for atom properties.
#        Used to dynamically define keys and have a bijective nomenclature for all properties
#     """
#     index, name, resid, resname, segid = range(5)
#     mapping = ["i.", "nm.", "r.", "rn.", "s."]
#     vmdsel = ["index", "name", "resid", "resname", "segname"]


# Path: PyContact/gui/Plotters.py
from PyQt5.QtWidgets import QSizePolicy, QApplication
from math import factorial
from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg \
    as FigureCanvas
from matplotlib.figure import Figure
from matplotlib import cm
from matplotlib import animation as ani
from ..core.ContactFilters import *
from ..core.Biochemistry import AccumulationMapIndex
from matplotlib import pyplot as plt
import numpy as np
import matplotlib
import seaborn as sns

                values.append(c.median_life_time(nsPerFrame, threshold))
                titles.append(c.title)
        elif attribute == "Hbond percentage":
            for c in currentContacts:
                values.append(c.hbond_percentage())
                titles.append(c.title)

        valuesNp = np.array(values, dtype=float)
        titlesNp = np.array(titles, dtype=str)

        x = range(len(currentContacts))
        # h = self.axes.bar(x, valuesNp, color="red")
        h = self.axes.bar(x, valuesNp)
        xticks_pos = [0.7071 * patch.get_width() + patch.get_xy()[0] for patch in h]
        self.axes.set_xticklabels(titlesNp, ha='right', size=8, rotation=45)
        self.axes.set_xticks(xticks_pos)
        for tick in self.axes.xaxis.get_major_ticks():
            tick.label.set_fontsize(xticksfontsize)
        self.axes.set_ylabel(attribute)
        self.fig.subplots_adjust(bottom=0.2, top=0.95, left=0.1, right=0.9)

    def saveFigure(self, path, outputFormat):
        self.fig.savefig(path + "." + outputFormat, format=outputFormat)


class MapPlotter(MplPlotter):
    """Simple canvas with an 2d heatmap plot."""
    def plotMap(self, contacts, map1, map2, label1, label2, attribute, threshold, nsPerFrame):
        minmaxresids1 = []
        minmaxresids2 = []

        if not map1[AccumulationMapIndex.resid] or not map2[AccumulationMapIndex.resid]: