当前位置: 首页>>代码示例>>Python>>正文


Python Shadow.draw方法代码示例

本文整理汇总了Python中matplotlib.patches.Shadow.draw方法的典型用法代码示例。如果您正苦于以下问题:Python Shadow.draw方法的具体用法?Python Shadow.draw怎么用?Python Shadow.draw使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在matplotlib.patches.Shadow的用法示例。


在下文中一共展示了Shadow.draw方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: draw

# 需要导入模块: from matplotlib.patches import Shadow [as 别名]
# 或者: from matplotlib.patches.Shadow import draw [as 别名]
    def draw(self, renderer):
        "Draw everything that belongs to the legend"
        if not self.get_visible(): return


        renderer.open_group('legend')


        fontsize = renderer.points_to_pixels(self._fontsize)

        # if mode == fill, set the width of the legend_box to the
        # width of the paret (minus pads)
        if self._mode in ["expand"]:
            pad = 2*(self.borderaxespad+self.borderpad)*fontsize
            self._legend_box.set_width(self.get_bbox_to_anchor().width-pad)

        if self._drawFrame:
            # update the location and size of the legend
            bbox = self._legend_box.get_window_extent(renderer)
            self.legendPatch.set_bounds(bbox.x0, bbox.y0,
                                        bbox.width, bbox.height)

            self.legendPatch.set_mutation_scale(fontsize)

            if self.shadow:
                shadow = Shadow(self.legendPatch, 2, -2)
                shadow.draw(renderer)

            self.legendPatch.draw(renderer)

        self._legend_box.draw(renderer)

        renderer.close_group('legend')
开发者ID:EnochManohar,项目名称:matplotlib,代码行数:35,代码来源:legend.py

示例2: draw

# 需要导入模块: from matplotlib.patches import Shadow [as 别名]
# 或者: from matplotlib.patches.Shadow import draw [as 别名]
    def draw(self, renderer):
        "Draw everything that belongs to the legend"
        if not self.get_visible(): return


        renderer.open_group('legend')


        # find_offset function will be provided to _legend_box and
        # _legend_box will draw itself at the location of the return
        # value of the find_offset.
        if self._loc == 0:
            _findoffset = self._findoffset_best
        else:
            _findoffset = self._findoffset_loc

        def findoffset(width, height, xdescent, ydescent):
            return _findoffset(width, height, xdescent, ydescent, renderer)

        self._legend_box.set_offset(findoffset)

        fontsize = renderer.points_to_pixels(self._fontsize)

        # if mode == fill, set the width of the legend_box to the
        # width of the paret (minus pads)
        if self._mode in ["expand"]:
            pad = 2*(self.borderaxespad+self.borderpad)*fontsize
            self._legend_box.set_width(self.get_bbox_to_anchor().width-pad)

        if self._drawFrame:
            # update the location and size of the legend
            bbox = self._legend_box.get_window_extent(renderer)
            self.legendPatch.set_bounds(bbox.x0, bbox.y0,
                                        bbox.width, bbox.height)

            self.legendPatch.set_mutation_scale(fontsize)

            if self.shadow:
                shadow = Shadow(self.legendPatch, 2, -2)
                shadow.draw(renderer)

            self.legendPatch.draw(renderer)

        self._legend_box.draw(renderer)

        renderer.close_group('legend')
开发者ID:AndreI11,项目名称:SatStressGui,代码行数:48,代码来源:legend.py


注:本文中的matplotlib.patches.Shadow.draw方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。