# Path: scgv/views/base.py
# class ViewerBase(object):
#     NORMALIZE_MIN = 0
#     NORMALIZE_MAX = 4
#     CHROM_LABELS = [
#         "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13",
#         "14", "15", "16", "17", "18", "19", "20", "21", "22", "X", "Y"
#     ]
# 
#     PLOIDY_LABELS = ["<2C", "2C", ">2C-4C", "4C", ">4C"]
# 
#     def __init__(self, model):
#         self.model = model
# 
#     @staticmethod
#     def calc_chrom_labels_pos(chrom_lines):
#         yt = (np.roll(chrom_lines, -1) - chrom_lines) / 2.0
#         return (chrom_lines + yt)[:-1]
# 
#     def clear_xlabels(self, ax):
#         ax.set_xticks(self.model.label_midpoints)
#         ax.set_xticklabels([''] * len(self.model.column_labels))
# 
#     def draw_xlabels(self, ax):
#         ax.set_xticks(self.model.label_midpoints)
#         ax.set_xticklabels(self.model.column_labels,
#                            rotation='vertical',
#                            fontsize=10)


import matplotlib.pyplot as plt
from matplotlib.colors import ListedColormap
from scgv.views.base import ViewerBase
        return TrackViewer.select_colormap_size(size)

    @classmethod
    def select_colormap_size(self, size):
        assert size <= 20
        if size > 12:
            cmap = plt.get_cmap('tab20')
        elif size > 7:
            cmap = plt.get_cmap('Paired')
        else:
            cmap = plt.get_cmap('tab10')
        colors = cmap.colors[:size]
        return ListedColormap(colors)

    def __init__(self, model, track_name, track, mapping):
        super(TrackViewer, self).__init__(model)

        self.track_name = track_name
        self.track = track
        self.track_mapping = mapping

    def draw(self, ax):
        if self.track is not None:

            cmap = self.select_colormap(self.track_mapping)
            vmin = min(self.track_mapping.values())
            vmax = max(self.track_mapping.values())
            track = self.track - vmin

            ax.imshow(

# Path: scgv/views/base.py
# class ViewerBase(object):
#     NORMALIZE_MIN = 0
#     NORMALIZE_MAX = 4
#     CHROM_LABELS = [
#         "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13",
#         "14", "15", "16", "17", "18", "19", "20", "21", "22", "X", "Y"
#     ]
# 
#     PLOIDY_LABELS = ["<2C", "2C", ">2C-4C", "4C", ">4C"]
# 
#     def __init__(self, model):
#         self.model = model
# 
#     @staticmethod
#     def calc_chrom_labels_pos(chrom_lines):
#         yt = (np.roll(chrom_lines, -1) - chrom_lines) / 2.0
#         return (chrom_lines + yt)[:-1]
# 
#     def clear_xlabels(self, ax):
#         ax.set_xticks(self.model.label_midpoints)
#         ax.set_xticklabels([''] * len(self.model.column_labels))
# 
#     def draw_xlabels(self, ax):
#         ax.set_xticks(self.model.label_midpoints)
#         ax.set_xticklabels(self.model.column_labels,
#                            rotation='vertical',
#                            fontsize=10)


# Path: scgv/views/track.py
import matplotlib.pyplot as plt
from matplotlib.colors import ListedColormap
from scgv.views.base import ViewerBase

        return TrackViewer.select_colormap_size(size)

    @classmethod
    def select_colormap_size(self, size):
        assert size <= 20
        if size > 12:
            cmap = plt.get_cmap('tab20')
        elif size > 7:
            cmap = plt.get_cmap('Paired')
        else:
            cmap = plt.get_cmap('tab10')
        colors = cmap.colors[:size]
        return ListedColormap(colors)

    def __init__(self, model, track_name, track, mapping):
        super(TrackViewer, self).__init__(model)

        self.track_name = track_name
        self.track = track
        self.track_mapping = mapping

    def draw(self, ax):
        if self.track is not None:

            cmap = self.select_colormap(self.track_mapping)
            vmin = min(self.track_mapping.values())
            vmax = max(self.track_mapping.values())
            track = self.track - vmin

            ax.imshow(

                [track],