Ejemplo n.º 1
0
    def __setattr__(self, key, value):
        # check type of AxisLabel specific attribute
        if key == 'orientation':
            self._check_type(str, key, value)
            self._check_membership(key, value, ('right', 'left', 'up', 'down'))

        Graph.__setattr__(self, key, value)
Ejemplo n.º 2
0
 def __setattr__(self, key, value):
     # check type of AxisLabel specific attribute
     if key == 'orientation':
         self._check_type(str, key, value)
         self._check_membership(key, value, ('right','left','up','down'))
         
     Graph.__setattr__(self, key, value)
Ejemplo n.º 3
0
 def autoscaley(self, pad=0, only_visible=True):
     """Over ride autoscale behavior of Graph.
     """
     dataset = self.add_dataset([(self.world.xmin, self.world.ymin),
                                 (self.world.xmax, self.world.ymax)])
     Graph.autoscaley(self, pad=pad)
     self.datasets.pop()
     self._datasetIndex -= 1
Ejemplo n.º 4
0
 def autoscaley(self, pad=0, only_visible=True):
     """Over ride autoscale behavior of Graph.
     """
     dataset = self.add_dataset([(self.world.xmin,self.world.ymin),
                                 (self.world.xmax,self.world.ymax)])
     Graph.autoscaley(self,pad=pad)
     self.datasets.pop()
     self._datasetIndex -= 1
Ejemplo n.º 5
0
 def __init__(self, data, *args, **kwargs):
     Graph.__init__(self, *args, **kwargs)
     self.dataset = self.add_dataset(data)
     self.world.ymin = 0
     self.world.xmin = 0
     self.world.xmax = 10
     self.autotick()
     xLabel = LatexString(r'\6X\f{}')
     self.xaxis.label.text = xLabel
     self.autoformat()
Ejemplo n.º 6
0
 def __init__(self, data, *args, **kwargs):
     Graph.__init__(self, *args, **kwargs)
     self.dataset = self.add_dataset(data)
     self.world.ymin = 0
     self.world.xmin = 0
     self.world.xmax = 10
     self.autotick()
     xLabel = LatexString(r'\6X\f{}')
     self.xaxis.label.text = xLabel
     self.autoformat()
Ejemplo n.º 7
0
    def __init__(self, *args, **kwargs):
        Graph.__init__(self, *args, **kwargs)

        # incorporate default axes
        self.xaxis = ElAxis(self, "x")
        self.yaxis = ElAxis(self, "y")
        self.altxaxis = ElAxis(self, "x", "alt", "off")
        self.altyaxis = ElAxis(self, "x", "alt", "off")

        # set legend
        self.legend = ElLegend(self, char_size=1.0)
Ejemplo n.º 8
0
    def __init__(self, *args, **kwargs):
        Graph.__init__(self, *args, **kwargs)

        # incorporate default axes
        self.xaxis = ElAxis(self, 'x')
        self.yaxis = ElAxis(self, 'y')
        self.altxaxis = ElAxis(self, 'x', 'alt', 'off')
        self.altyaxis = ElAxis(self, 'x', 'alt', 'off')

        # set legend
        self.legend = ElLegend(self, char_size=1.0)
Ejemplo n.º 9
0
    def __init__(self, *args, **kwargs):
        Graph.__init__(self, *args, **kwargs)

        # incorporate default axes
        self.xaxis = MetraAxis(self,'x')
        self.yaxis = MetraAxis(self,'y')
        self.altxaxis = MetraAxis(self,'x','alt','off')
        self.altyaxis = MetraAxis(self,'x','alt','off')

        # set legend
        self.legend = MetraLegend(self)
Ejemplo n.º 10
0
    def __init__(self, dataList, *args, **kwargs):
        Graph.__init__(self, *args, **kwargs)

        # make graph square
        self.view.xmax = self.view.xmin + (self.view.ymax - self.view.ymin)

        # add the datasets that are given
        for index, data in enumerate(dataList):
            self.dataset = self.add_dataset(data, ScatterPoints, index + 2)

        # autoscale the axes
        self.autoscale()
Ejemplo n.º 11
0
    def __init__(self, dataList, *args, **kwargs):
        Graph.__init__(self, *args, **kwargs)

        # make graph square
        self.view.xmax = self.view.xmin + (self.view.ymax - self.view.ymin)

        # add the datasets that are given
        for index, data in enumerate(dataList):
            self.dataset = self.add_dataset(data, ScatterPoints, index + 2)

        # autoscale the axes
        self.autoscale()
Ejemplo n.º 12
0
    def __init__(self, panel_index=None, *args, **kwargs):
        Graph.__init__(self, *args, **kwargs)

        # find a default index for this graph
        if panel_index is None:
            if self.index is None:
                panel_index = 0
            else:
                panel_index = self.index

        # specify the default justification for the label
        self.panel_label = self.add_drawing_object(PanelLabel, panel_index)
Ejemplo n.º 13
0
    def __init__(self,panel_index=None,
                 *args,**kwargs):
        Graph.__init__(self,*args,**kwargs)

        # find a default index for this graph
        if panel_index is None:
            if self.index is None:
                panel_index = 0
            else:
                panel_index = self.index

        # specify the default justification for the label
        self.panel_label = self.add_drawing_object(PanelLabel,panel_index)
Ejemplo n.º 14
0
    def __init__(self, bounding_box=False, *args, **kwargs):
        Graph.__init__(self, *args, **kwargs)

        self.node_xy = {}  # stores node coordinates
        self.node_sz = {}  # stores node sizes
        self.xaxis.onoff='off'
        self.yaxis.onoff='off'
        if not bounding_box:
            self.frame.linestyle = 0
        self.view.configure(xmin = 0.01 * self.parent.max_canvas_width,
                            xmax = 0.99 * self.parent.max_canvas_width,
                            ymin = 0.01 * self.parent.max_canvas_height,
                            ymax = 0.99 * self.parent.max_canvas_height)
Ejemplo n.º 15
0
    def __init__(self, bounding_box=False, *args, **kwargs):
        Graph.__init__(self, *args, **kwargs)

        self.node_xy = {}  # stores node coordinates
        self.node_sz = {}  # stores node sizes
        self.xaxis.onoff = 'off'
        self.yaxis.onoff = 'off'
        if not bounding_box:
            self.frame.linestyle = 0
        self.view.configure(xmin=0.01 * self.parent.max_canvas_width,
                            xmax=0.99 * self.parent.max_canvas_width,
                            ymin=0.01 * self.parent.max_canvas_height,
                            ymax=0.99 * self.parent.max_canvas_height)
Ejemplo n.º 16
0
    def __init__(self,
                 domain=(),
                 scale=LINEAR_SCALE,
                 autoscale=True,
                 reverse=False,
                 color_range=(),
                 *args,
                 **kwargs):
        Graph.__init__(self, *args, **kwargs)

        # should we reverse the colors
        self.reverse = reverse

        # turn off the xaxis labels
        self.xaxis.ticklabel.onoff = "off"
        self.xaxis.tick.onoff = "off"

        # specify the scale on the yaxis
        self.set_scale(scale)

        # place labels on opposite side
        self.yaxis.ticklabel.place = 'opposite'
        self.yaxis.label.place = 'opposite'

        # make frame super skinny
        self.view.xmin = self.view.xmax - 0.1 * (self.view.ymax -
                                                 self.view.ymin)

        # remember the range of colors to be used
        if not color_range:
            if self.parent is None:
                self.color_range = []
            else:
                self.color_range = range(2, len(self.parent.colors))
                self.color_range.reverse()
        else:
            self.color_range = color_range
            self.color_range.reverse()

        # set the domain
        if domain:
            self.set_domain(domain, autoscale)
        else:
            self.set_domain((0, 1), autoscale)
Ejemplo n.º 17
0
    def __init__(self, domain=(), scale=LINEAR_SCALE, autoscale=True,
                 reverse=False, color_range=(), *args, **kwargs):
        Graph.__init__(self,*args,**kwargs)

        # should we reverse the colors
        self.reverse = reverse

        # turn off the xaxis labels
        self.xaxis.ticklabel.onoff = "off"
        self.xaxis.tick.onoff = "off"

        # specify the scale on the yaxis
        self.set_scale(scale)

        # place labels on opposite side
        self.yaxis.ticklabel.place = 'opposite'
        self.yaxis.label.place = 'opposite'

        # make frame super skinny
        self.view.xmin = self.view.xmax - 0.1*(self.view.ymax - self.view.ymin)

        # remember the range of colors to be used
        if not color_range:
            if self.parent is None:
                self.color_range = []
            else:
                self.color_range = range(2,len(self.parent.colors))
                self.color_range.reverse()
        else:
            self.color_range = color_range
            self.color_range.reverse()

        # set the domain
        if domain:
            self.set_domain(domain,autoscale)
        else:
            self.set_domain((0,1),autoscale)
Ejemplo n.º 18
0
    def __init__(self, parent, orientation='right', **kwargs):
        Graph.__init__(self, parent, **kwargs)
        
        self.labels = {}  # stores leaf labels
        for axis in [self.xaxis, self.yaxis]:
            axis.bar.onoff='off'
            axis.tick.onoff='off'

        # adjust axis properties based on orientation
        self.orientation = orientation
        if self.orientation in ['right','left']:
            self.xaxis.ticklabel.onoff='off'
            if self.orientation == 'right':
                self.yaxis.ticklabel.place = 'opposite'
        elif self.orientation in ['up','down']:
            self.yaxis.ticklabel.onoff='off'
            if self.orientation == 'up':
                self.xaxis.ticklabel.place = 'opposite'

        self.frame.linestyle = 0
        self.view.configure(xmin = 0.075 * self.parent.max_canvas_width,
                            xmax = 0.925 * self.parent.max_canvas_width,
                            ymin = 0.075 * self.parent.max_canvas_height,
                            ymax = 0.925 * self.parent.max_canvas_height)
Ejemplo n.º 19
0
    def __init__(self, parent, orientation='right', **kwargs):
        Graph.__init__(self, parent, **kwargs)

        self.labels = {}  # stores leaf labels
        for axis in [self.xaxis, self.yaxis]:
            axis.bar.onoff = 'off'
            axis.tick.onoff = 'off'

        # adjust axis properties based on orientation
        self.orientation = orientation
        if self.orientation in ['right', 'left']:
            self.xaxis.ticklabel.onoff = 'off'
            if self.orientation == 'right':
                self.yaxis.ticklabel.place = 'opposite'
        elif self.orientation in ['up', 'down']:
            self.yaxis.ticklabel.onoff = 'off'
            if self.orientation == 'up':
                self.xaxis.ticklabel.place = 'opposite'

        self.frame.linestyle = 0
        self.view.configure(xmin=0.075 * self.parent.max_canvas_width,
                            xmax=0.925 * self.parent.max_canvas_width,
                            ymin=0.075 * self.parent.max_canvas_height,
                            ymax=0.925 * self.parent.max_canvas_height)
Ejemplo n.º 20
0
 def __str__(self):
     """Override the __str__ functionality to draw the colorbar at
     draw time.
     """
     self.add_colors()
     return Graph.__str__(self)
Ejemplo n.º 21
0
 def __str__(self):
     """Override the __str__ functionality to draw the colorbar at
     draw time.
     """
     self.add_colors()
     return Graph.__str__(self)