Beispiel #1
0
    def _update_label_position(self, bboxes, bboxes2):
        """
        Update the label position based on the sequence of bounding
        boxes of all the ticklabels
        """

        x, y = self.label.get_position()
        if self.label_position == 'left':
            if not len(bboxes):
                left = self.axes.bbox.xmin()
            else:

                bbox = bbox_all(bboxes)
                left = bbox.xmin()

            self.label.set_position(
                (left - self.LABELPAD * self.figure.dpi.get() / 72.0, y))

        else:
            if not len(bboxes2):
                right = self.axes.bbox.xmax()
            else:

                bbox = bbox_all(bboxes2)
                right = bbox.xmax()

            self.label.set_position(
                (right + self.LABELPAD * self.figure.dpi.get() / 72.0, y))
Beispiel #2
0
    def _update_label_position(self, bboxes, bboxes2):
        """
        Update the label position based on the sequence of bounding
        boxes of all the ticklabels
        """

        x, y = self.label.get_position()
        if self.label_position == 'bottom':
            if not len(bboxes):
                bottom = self.axes.bbox.ymin()
            else:

                bbox = bbox_all(bboxes)
                bottom = bbox.ymin()

            self.label.set_position(
                (x, bottom - self.LABELPAD * self.figure.dpi.get() / 72.0))

        else:
            if not len(bboxes2):
                top = self.axes.bbox.ymax()
            else:

                bbox = bbox_all(bboxes2)
                top = bbox.ymax()

            self.label.set_position(
                (x, top + self.LABELPAD * self.figure.dpi.get() / 72.0))
Beispiel #3
0
    def _update_label_position(self, bboxes, bboxes2):
        """
        Update the label position based on the sequence of bounding
        boxes of all the ticklabels
        """

        x,y = self.label.get_position()
        if self.label_position == 'bottom':
            if not len(bboxes):
                bottom = self.axes.bbox.ymin()
            else:

                bbox = bbox_all(bboxes)
                bottom = bbox.ymin()

            self.label.set_position( (x, bottom-self.LABELPAD*self.figure.dpi.get()/72.0))

        else:
            if not len(bboxes2):
                top = self.axes.bbox.ymax()
            else:

                bbox = bbox_all(bboxes2)
                top = bbox.ymax()

            self.label.set_position( (x, top+self.LABELPAD*self.figure.dpi.get()/72.0))
Beispiel #4
0
    def _update_label_position(self, bboxes, bboxes2):
        """
        Update the label position based on the sequence of bounding
        boxes of all the ticklabels
        """

        x,y = self.label.get_position()
        if self.label_position == 'left':
            if not len(bboxes):
                left = self.axes.bbox.xmin()
            else:

                bbox = bbox_all(bboxes)
                left = bbox.xmin()

            self.label.set_position( (left-self.LABELPAD*self.figure.dpi.get()/72.0, y))

        else:
            if not len(bboxes2):
                right = self.axes.bbox.xmax()
            else:

                bbox = bbox_all(bboxes2)
                right = bbox.xmax()

            self.label.set_position( (right+self.LABELPAD*self.figure.dpi.get()/72.0, y))
Beispiel #5
0
    def _get_grid_bbox(self, renderer):
        """Get a bbox, in axes co-ordinates for the cells.

        Only include those in the range (0,0) to (maxRow, maxCol)"""
        boxes = [self._cells[pos].get_window_extent(renderer)
                 for pos in self._cells.keys()
                 if pos[0] >= 0 and pos[1] >= 0]

        bbox = bbox_all(boxes)
        return inverse_transform_bbox(self._transform, bbox)
Beispiel #6
0
 def _update_offset_text_position(self, bboxes, bboxes2):
     """
     Update the offset_text position based on the sequence of bounding
     boxes of all the ticklabels
     """
     x,y = self.offsetText.get_position()
     if not len(bboxes):
         bottom = self.axes.bbox.ymin()
     else:
         bbox = bbox_all(bboxes)
         bottom = bbox.ymin()
     self.offsetText.set_position((x, bottom-self.OFFSETTEXTPAD*self.figure.dpi.get()/72.0))
Beispiel #7
0
 def _update_offset_text_position(self, bboxes, bboxes2):
     """
     Update the offset_text position based on the sequence of bounding
     boxes of all the ticklabels
     """
     x,y = self.offsetText.get_position()
     if not len(bboxes):
         bottom = self.axes.bbox.ymin()
     else:
         bbox = bbox_all(bboxes)
         bottom = bbox.ymin()
     self.offsetText.set_position((x, bottom-self.OFFSETTEXTPAD*self.figure.dpi.get()/72.0))
Beispiel #8
0
    def _update_label_postion(self, bboxes):
        """
        Update the label position based on the sequence of bounding
        boxes overlaps of all the ticklabels that overlap the current
        ticklabel.  overlaps are the bounding boxes of the ticklabels
        """

        x,y = self.label.get_position()
        if not len(bboxes):
            left = self.axes.bbox.xmin()
        else:
            bbox = bbox_all(bboxes)
            left = bbox.xmin()
        self.label.set_position((left - self.figure.dpi.get()*self.LABELPAD/72.0,y))
Beispiel #9
0
    def _update_label_postion(self, bboxes):
        """
        Update the label position based on the sequence of bounding
        boxes overlaps of all the ticklabels that overlap the current
        ticklabel.  overlaps are the bounding boxes of the ticklabels
        """

        x,y = self.label.get_position()
        if not len(bboxes):
            left = self.axes.bbox.xmin()
        else:
            bbox = bbox_all(bboxes)
            left = bbox.xmin()
        self.label.set_position((left - self.figure.dpi.get()*self.LABELPAD/72.0,y))
Beispiel #10
0
    def _get_handle_text_bbox(self, renderer):
        "Get a bbox for the text and lines in axes coords"

        bboxesText = [t.get_window_extent(renderer) for t in self.texts]
        bboxesHandles = [h.get_window_extent(renderer) for h in self.legendHandles if h is not None]

        bboxesAll = bboxesText
        bboxesAll.extend(bboxesHandles)
        bbox = bbox_all(bboxesAll)
        self.save = bbox

        ibox = inverse_transform_bbox(self._transform, bbox)
        self.ibox = ibox

        return ibox
Beispiel #11
0
    def _get_handle_text_bbox(self, renderer):
        'Get a bbox for the text and lines in axes coords'
        boxes = []
        bboxesText = [t.get_window_extent(renderer) for t in self._texts]
        bboxesHandles = [h.get_window_extent(renderer) for h in self._handles]

        bboxesAll = bboxesText
        bboxesAll.extend(bboxesHandles)
        bbox = bbox_all(bboxesAll)
        self.save = bbox

        ibox = inverse_transform_bbox(self._transform, bbox)
        self.ibox = ibox

        return ibox
Beispiel #12
0
    def contains(self, mouseevent):
        """Test whether the mouse event occurred in the table.

        Returns T/F, {}
        """
        if callable(self._contains): return self._contains(self, mouseevent)

        # TODO: Return index of the cell containing the cursor so that the user
        # doesn't have to bind to each one individually.
        if self._cachedRenderer is not None:
            boxes = [
                self._cells[pos].get_window_extent(self._cachedRenderer)
                for pos in self._cells.keys() if pos[0] >= 0 and pos[1] >= 0
            ]
            bbox = bbox_all(boxes)
            return bbox.contains(mouseevent.x, mouseevent.y), {}
        else:
            return False, {}
Beispiel #13
0
    def get_window_extent(self, renderer=None):

        boxes = [c.get_window_extent(renderer) for c in self._cells]
        return bbox_all(boxes)
Beispiel #14
0
 def get_window_extent(self, renderer):
     'Return the bounding box of the table in window coords'
     boxes = [c.get_window_extent(renderer) for c in self._cells]
     return bbox_all(boxes)
Beispiel #15
0
 def get_window_extent(self, renderer):
     'Return the bounding box of the table in window coords'
     boxes = [c.get_window_extent(renderer) for c in self._cells]
     return bbox_all(boxes)
Beispiel #16
0
    def get_window_extent(self, renderer):

        boxes = [c.get_window_extent(renderer) for c in self._cells]
        return bbox_all(boxes)