rg2d_plotter.py 793 Bytes
Newer Older
Theo Steininger's avatar
Theo Steininger committed
1
2
3
# -*- coding: utf-8 -*-


Martin Reinecke's avatar
Martin Reinecke committed
4
5
6
from ...spaces import RGSpace
from ..figures import Figure2D
from ..plots import Heatmap
Theo Steininger's avatar
Theo Steininger committed
7
8
9
10
from .plotter_base import PlotterBase


class RG2DPlotter(PlotterBase):
11
    def __init__(self, interactive=False, path='plot.html', color_map=None):
Theo Steininger's avatar
Theo Steininger committed
12
        self.color_map = color_map
13
        super(RG2DPlotter, self).__init__(interactive, path)
Theo Steininger's avatar
Theo Steininger committed
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29

    @property
    def domain_classes(self):
        return (RGSpace, )

    def _initialize_plot(self):
        return Heatmap(data=None,
                       color_map=self.color_map)

    def _initialize_figure(self):
        return Figure2D(plots=None)

    def _parse_data(self, data, field, spaces):
        if len(data.shape) != 2:
            AttributeError("Only 2-dimensional RGSpaces are supported")
        return data