cartesian_2D.py 959 Bytes
Newer Older
1
2
3
4
5
6
# -*- coding: utf-8 -*-

from cartesian import Cartesian


class Cartesian2D(Cartesian):
Theo Steininger's avatar
Theo Steininger committed
7
    def __init__(self, data, label='', line=None, marker=None, showlegend=True,
8
                 webgl=True):
Theo Steininger's avatar
Theo Steininger committed
9
        super(Cartesian2D, self).__init__(data, label, line, marker,
10
                                          showlegend)
11
12
        self.webgl = webgl

Theo Steininger's avatar
Theo Steininger committed
13
14
15
16
17
18
19
20
    def at(self, data):
        return Cartesian2D(data=data,
                           label=self.label,
                           line=self.line,
                           marker=self.marker,
                           showlegend=self.showlegend,
                           webgl=self.webgl)

21
22
23
24
    @property
    def figure_dimension(self):
        return 2

25
26
27
28
29
30
31
32
    def to_plotly(self):
        plotly_object = super(Cartesian2D, self).to_plotly()
        if self.webgl:
            plotly_object['type'] = 'scattergl'
        else:
            plotly_object['type'] = 'scatter'

        return plotly_object