 = c[i][j]

    d = __pd.DataFrame(c)
    d.columns = sample_names
    d.index = sample_names

    g = __sns.clustermap(d, method=method, cmap="viridis", robust=True);

    if return_string:
        figfile = __BytesIO()
        g.savefig(figfile, bbox_inches='tight', format='png')
        __plt.close()
        figfile.seek(0)
        figdata_png = __base64.b64encode(figfile.getvalue())
        return figdata_png
    else:
        __plt.show()
        __plt.close()
        return g


def plot_SNV_spectrum(spectrumDict,
                      return_string=False, normalize_to_1=False):
    """

    Plots the triplet spectrum for a list of 96-element vectors defined in spectrumDict.

    :param spectrumDict: a dictionary containing spectra as values and sample names as keys (dictionary)
    :param normalize_to_1: If True, results are plotted as percentages, instead of counts. (default: False) (bool)
    :param return_string: If True, only a temporary plot is generated and its base64 code is returned, that can be included in HTML files. (default: False) (bool)

    :returns: If the return_string value is True, a base64 encoded string of the image. Otherwise, a list of matplotlib figures.

    """

    try:
        __sns.set(style="white", font="DejaVu Sans")
    except:
        pass

    all_muttypes = ["ACAA", "TGTT", "ACCA", "GGTT", "ACGA", "CGTT", "ACTA", "AGTT", "CCAA", "TGGT",
                    "CCCA", "GGGT", "CCGA", "CGGT", "CCTA", "AGGT", "GCAA", "TGCT", "GCCA", "GGCT",
                    "GCGA", "CGCT", "GCTA", "AGCT", "TCAA", "TGAT", "TCCA", "GGAT", "TCGA", "CGAT",
                    "TCTA", "AGAT", "ACAG", "TGTC", "ACCG", "GGTC", "ACGG", "CGTC", "ACTG", "AGTC",
                    "CCAG", "TGGC", "CCCG", "GGGC", "CCGG", "CGGC", "CCTG", "AGGC", "GCAG", "TGCC",
                    "GCCG", "GGCC", "GCGG", "CGCC", "GCTG", "AGCC", "TCAG", "TGAC", "TCCG", "GGAC",
                    "TCGG", "CGAC", "TCTG", "AGAC", "ACAT", "TGTA", "ACCT", "GGTA", "ACGT", "CGTA",
                    "ACTT", "AGTA", "CCAT", "TGGA", "CCCT", "GGGA", "CCGT", "CGGA", "CCTT", "AGGA",
                    "GCAT", "TGCA", "GCCT", "GGCA", "GCGT", "CGCA", "GCTT", "AGCA", "TCAT", "TGAA",
                    "TCCT", "GGAA", "TCGT", "CGAA", "TCTT", "AGAA", "ATAA", "TATT", "ATCA", "GATT",
                    "ATGA", "CATT", "ATTA", "AATT", "CTAA", "TAGT", "CTCA", "GAGT", "CTGA", "CAGT",
                    "CTTA", "AAGT", "GTAA", "TACT", "GTCA", "GACT", "GTGA", "CACT", "GTTA", "AACT",
                    "TTAA", "TAAT", "TTCA", "GAAT", "TTGA", "CAAT", "TTTA", "AAAT", "ATAC", "TATG",
                    "ATCC", "GATG", "ATGC", "CATG", "ATTC", "AATG", "CTAC", "TAGG", "CTCC", "GAGG",
                    "CTGC", "CAGG", "CTTC", "AAGG", "GTAC", "TACG", "GTCC", "GACG", "GTGC", "CACG",
                    "GTTC", "AACG", "TTAC", "TAAG", "TTCC", "GAAG", "TTGC", "CAAG", "TTTC", "AAAG",
                    "ATAG", "TATC", "ATCG", "GATC", "ATGG", "CATC", "ATTG", "AATC", "CTAG", "TAGC",
                    "CTCG", "GAGC", "CTGG", "CAGC", "CTTG", "AAGC", "GTAG", "TACC", "GTCG", "GACC",
                    "GTGG", "CACC", "GTTG", "AACC", "TTAG", "TAAC", "TTCG", "GAAC", "TTGG", "CAAC",
                    "TTTG", "AAAC"]

    mut_xlabel = [i[0] + i[1] + i[2] for i in all_muttypes[::2]]
    mut_title = ['C > A', 'C > G', 'C > T', 'T > A', 'T > C', 'T > G']

    ind = __np.arange(16)
    width = 0.4

    spectrum_colors = []
    spectrum_colors.append('#03bcee')
    spectrum_colors.append('#010101')
    spectrum_colors.append('#e32926')
    spectrum_colors.append('#999999')
    spectrum_colors.append('#a1ce63')
    spectrum_colors.append('#ebc6c4')

    figs = []

    for sample_name, spectrum_orig in spectrumDict.items():

        if normalize_to_1:
            spectrum = __np.array(spectrum_orig) / __np.sum(spectrum_orig)
        else:
            spectrum = spectrum_orig

        f, axarr = __plt.subplots(1, 6, sharey=True)
        f.set_size_inches(20, 3)

        for i in range(6):
            axarr[i].bar(ind, spectrum[i * 16:(i + 1) * 16], width, color=spectrum_colors[i],
                         edgecolor=spectrum_colors[i])
            axarr[i].xaxis.set_ticks(__np.linspace(0, 16, 17))
            axarr[i].set_xticks(ind + width)
            axarr[i].xaxis.set_tick_params(size=0)
            axarr[i].yaxis.set_tick_params(size=0)
            axarr[i].set_xticklabels(mut_xlabel[i * 16:(i + 1) * 16], rotation='vertical', size=9)
            axarr[i].text(0.5, 1.08, mut_title[i], size=12, ha="center", transform=axarr[i].transAxes)

            axarr[i].add_patch(
                __Rectangle((0, 1.01), 1, 0.05, color=spectrum_colors[i], transform=axarr[i].transAxes,
                            clip_on=False))
            axarr[i].spines['right'].set_visible(False)
            axarr[i].spines['top'].set_visible(False)
            axarr[i].set_ylim(0, max(spectrum) * 1.1)
            if i == 0:
                axarr[i].set_ylabel(sample_name + '\n', fontsize=12)
            if i!= 0:
                axarr[i].spines['left'].set_visible(False)

        if normalize_to_1:
            vals = axarr[0].get_yticks()
            axarr[0].set_yticklabels(['{:,.1%}'.format(x) for x in vals])

        if return_string:
            figfile = __BytesIO()
            f.savefig(figfile, bbox_inches='tight', format='png')
            __plt.close()
            figfile.seek(0)
            figdata_png = __base64.b64encode(figfile.getvalue())
            figs.append(figdata_png)
        else:
            __plt.show()
            figs.append(f)
            __plt.close(f)

    return figs


def plot_indel