Python matplotlib.patches.bbox_artist() Examples

The following are 8 code examples of matplotlib.patches.bbox_artist(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module matplotlib.patches , or try the search function .
Example #1
Source File: axis.py    From Computable with MIT License 5 votes vote down vote up
def draw(self, renderer, *args, **kwargs):
        'Draw the axis lines, grid lines, tick lines and labels'

        if not self.get_visible():
            return
        renderer.open_group(__name__)

        ticks_to_draw = self._update_ticks(renderer)
        ticklabelBoxes, ticklabelBoxes2 = self._get_tick_bboxes(ticks_to_draw,
                                                                renderer)

        for tick in ticks_to_draw:
            tick.draw(renderer)

        # scale up the axis label box to also find the neighbors, not
        # just the tick labels that actually overlap note we need a
        # *copy* of the axis label box because we don't wan't to scale
        # the actual bbox

        self._update_label_position(ticklabelBoxes, ticklabelBoxes2)

        self.label.draw(renderer)

        self._update_offset_text_position(ticklabelBoxes, ticklabelBoxes2)
        self.offsetText.set_text(self.major.formatter.get_offset())
        self.offsetText.draw(renderer)

        if 0:  # draw the bounding boxes around the text for debug
            for tick in self.majorTicks:
                label = tick.label1
                mpatches.bbox_artist(label, renderer)
            mpatches.bbox_artist(self.label, renderer)

        renderer.close_group(__name__) 
Example #2
Source File: axis.py    From matplotlib-4-abaqus with MIT License 5 votes vote down vote up
def draw(self, renderer, *args, **kwargs):
        'Draw the axis lines, grid lines, tick lines and labels'

        if not self.get_visible():
            return
        renderer.open_group(__name__)

        ticks_to_draw = self._update_ticks(renderer)
        ticklabelBoxes, ticklabelBoxes2 = self._get_tick_bboxes(ticks_to_draw,
                                                                renderer)

        for tick in ticks_to_draw:
            tick.draw(renderer)

        # scale up the axis label box to also find the neighbors, not
        # just the tick labels that actually overlap note we need a
        # *copy* of the axis label box because we don't wan't to scale
        # the actual bbox

        self._update_label_position(ticklabelBoxes, ticklabelBoxes2)

        self.label.draw(renderer)

        self._update_offset_text_position(ticklabelBoxes, ticklabelBoxes2)
        self.offsetText.set_text(self.major.formatter.get_offset())
        self.offsetText.draw(renderer)

        if 0:  # draw the bounding boxes around the text for debug
            for tick in self.majorTicks:
                label = tick.label1
                mpatches.bbox_artist(label, renderer)
            mpatches.bbox_artist(self.label, renderer)

        renderer.close_group(__name__) 
Example #3
Source File: axis.py    From neural-network-animation with MIT License 5 votes vote down vote up
def draw(self, renderer, *args, **kwargs):
        'Draw the axis lines, grid lines, tick lines and labels'

        if not self.get_visible():
            return
        renderer.open_group(__name__)

        ticks_to_draw = self._update_ticks(renderer)
        ticklabelBoxes, ticklabelBoxes2 = self._get_tick_bboxes(ticks_to_draw,
                                                                renderer)

        for tick in ticks_to_draw:
            tick.draw(renderer)

        # scale up the axis label box to also find the neighbors, not
        # just the tick labels that actually overlap note we need a
        # *copy* of the axis label box because we don't wan't to scale
        # the actual bbox

        self._update_label_position(ticklabelBoxes, ticklabelBoxes2)

        self.label.draw(renderer)

        self._update_offset_text_position(ticklabelBoxes, ticklabelBoxes2)
        self.offsetText.set_text(self.major.formatter.get_offset())
        self.offsetText.draw(renderer)

        if 0:  # draw the bounding boxes around the text for debug
            for tick in self.majorTicks:
                label = tick.label1
                mpatches.bbox_artist(label, renderer)
            mpatches.bbox_artist(self.label, renderer)

        renderer.close_group(__name__) 
Example #4
Source File: axis.py    From GraphicDesignPatternByPython with MIT License 5 votes vote down vote up
def draw(self, renderer, *args, **kwargs):
        'Draw the axis lines, grid lines, tick lines and labels'

        if not self.get_visible():
            return
        renderer.open_group(__name__)

        ticks_to_draw = self._update_ticks(renderer)
        ticklabelBoxes, ticklabelBoxes2 = self._get_tick_bboxes(ticks_to_draw,
                                                                renderer)

        for tick in ticks_to_draw:
            tick.draw(renderer)

        # scale up the axis label box to also find the neighbors, not
        # just the tick labels that actually overlap note we need a
        # *copy* of the axis label box because we don't wan't to scale
        # the actual bbox

        self._update_label_position(renderer)

        self.label.draw(renderer)

        self._update_offset_text_position(ticklabelBoxes, ticklabelBoxes2)
        self.offsetText.set_text(self.major.formatter.get_offset())
        self.offsetText.draw(renderer)

        if 0:  # draw the bounding boxes around the text for debug
            for tick in self.majorTicks:
                label = tick.label1
                mpatches.bbox_artist(label, renderer)
            mpatches.bbox_artist(self.label, renderer)

        renderer.close_group(__name__)
        self.stale = False 
Example #5
Source File: axis.py    From python3_ios with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def draw(self, renderer, *args, **kwargs):
        'Draw the axis lines, grid lines, tick lines and labels'

        if not self.get_visible():
            return
        renderer.open_group(__name__)

        ticks_to_draw = self._update_ticks(renderer)
        ticklabelBoxes, ticklabelBoxes2 = self._get_tick_bboxes(ticks_to_draw,
                                                                renderer)

        for tick in ticks_to_draw:
            tick.draw(renderer)

        # scale up the axis label box to also find the neighbors, not
        # just the tick labels that actually overlap note we need a
        # *copy* of the axis label box because we don't wan't to scale
        # the actual bbox

        self._update_label_position(renderer)

        self.label.draw(renderer)

        self._update_offset_text_position(ticklabelBoxes, ticklabelBoxes2)
        self.offsetText.set_text(self.major.formatter.get_offset())
        self.offsetText.draw(renderer)

        if 0:  # draw the bounding boxes around the text for debug
            for tick in self.majorTicks:
                label = tick.label1
                mpatches.bbox_artist(label, renderer)
            mpatches.bbox_artist(self.label, renderer)

        renderer.close_group(__name__)
        self.stale = False 
Example #6
Source File: axis.py    From ImageFusion with MIT License 5 votes vote down vote up
def draw(self, renderer, *args, **kwargs):
        'Draw the axis lines, grid lines, tick lines and labels'

        if not self.get_visible():
            return
        renderer.open_group(__name__)

        ticks_to_draw = self._update_ticks(renderer)
        ticklabelBoxes, ticklabelBoxes2 = self._get_tick_bboxes(ticks_to_draw,
                                                                renderer)

        for tick in ticks_to_draw:
            tick.draw(renderer)

        # scale up the axis label box to also find the neighbors, not
        # just the tick labels that actually overlap note we need a
        # *copy* of the axis label box because we don't wan't to scale
        # the actual bbox

        self._update_label_position(ticklabelBoxes, ticklabelBoxes2)

        self.label.draw(renderer)

        self._update_offset_text_position(ticklabelBoxes, ticklabelBoxes2)
        self.offsetText.set_text(self.major.formatter.get_offset())
        self.offsetText.draw(renderer)

        if 0:  # draw the bounding boxes around the text for debug
            for tick in self.majorTicks:
                label = tick.label1
                mpatches.bbox_artist(label, renderer)
            mpatches.bbox_artist(self.label, renderer)

        renderer.close_group(__name__) 
Example #7
Source File: axis.py    From coffeegrindsize with MIT License 5 votes vote down vote up
def draw(self, renderer, *args, **kwargs):
        'Draw the axis lines, grid lines, tick lines and labels'

        if not self.get_visible():
            return
        renderer.open_group(__name__)

        ticks_to_draw = self._update_ticks(renderer)
        ticklabelBoxes, ticklabelBoxes2 = self._get_tick_bboxes(ticks_to_draw,
                                                                renderer)

        for tick in ticks_to_draw:
            tick.draw(renderer)

        # scale up the axis label box to also find the neighbors, not
        # just the tick labels that actually overlap note we need a
        # *copy* of the axis label box because we don't wan't to scale
        # the actual bbox

        self._update_label_position(renderer)

        self.label.draw(renderer)

        self._update_offset_text_position(ticklabelBoxes, ticklabelBoxes2)
        self.offsetText.set_text(self.major.formatter.get_offset())
        self.offsetText.draw(renderer)

        if 0:  # draw the bounding boxes around the text for debug
            for tick in self.majorTicks:
                label = tick.label1
                mpatches.bbox_artist(label, renderer)
            mpatches.bbox_artist(self.label, renderer)

        renderer.close_group(__name__)
        self.stale = False 
Example #8
Source File: axis.py    From twitter-stock-recommendation with MIT License 5 votes vote down vote up
def draw(self, renderer, *args, **kwargs):
        'Draw the axis lines, grid lines, tick lines and labels'

        if not self.get_visible():
            return
        renderer.open_group(__name__)

        ticks_to_draw = self._update_ticks(renderer)
        ticklabelBoxes, ticklabelBoxes2 = self._get_tick_bboxes(ticks_to_draw,
                                                                renderer)

        for tick in ticks_to_draw:
            tick.draw(renderer)

        # scale up the axis label box to also find the neighbors, not
        # just the tick labels that actually overlap note we need a
        # *copy* of the axis label box because we don't wan't to scale
        # the actual bbox

        self._update_label_position(renderer)

        self.label.draw(renderer)

        self._update_offset_text_position(ticklabelBoxes, ticklabelBoxes2)
        self.offsetText.set_text(self.major.formatter.get_offset())
        self.offsetText.draw(renderer)

        if 0:  # draw the bounding boxes around the text for debug
            for tick in self.majorTicks:
                label = tick.label1
                mpatches.bbox_artist(label, renderer)
            mpatches.bbox_artist(self.label, renderer)

        renderer.close_group(__name__)
        self.stale = False