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


Python Bbox.unit方法代码示例

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


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

示例1: get_window_extent

# 需要导入模块: from transforms import Bbox [as 别名]
# 或者: from transforms.Bbox import unit [as 别名]
 def get_window_extent(self, renderer):
     bbox = Bbox.unit()
     bbox.update_from_data_xy(self.get_transform().transform(self.get_xydata()), ignore=True)
     # correct for marker size, if any
     if self._marker:
         ms = (self._markersize / 72.0 * self.figure.dpi) * 0.5
         bbox = bbox.padded(ms)
     return bbox
开发者ID:embray,项目名称:matplotlib,代码行数:10,代码来源:lines.py

示例2: set_clip_path

# 需要导入模块: from transforms import Bbox [as 别名]
# 或者: from transforms.Bbox import unit [as 别名]
    def set_clip_path(self, path, transform=None):
        """
        Set the artist's clip path, which may be:

          * a :class:`~matplotlib.patches.Patch` (or subclass) instance

          * a :class:`~matplotlib.path.Path` instance, in which case
             an optional :class:`~matplotlib.transforms.Transform`
             instance may be provided, which will be applied to the
             path before using it for clipping.

          * *None*, to remove the clipping path

        For efficiency, if the path happens to be an axis-aligned
        rectangle, this method will set the clipping box to the
        corresponding rectangle and set the clipping path to *None*.

        ACCEPTS: [ (:class:`~matplotlib.path.Path`,
        :class:`~matplotlib.transforms.Transform`) |
        :class:`~matplotlib.patches.Patch` | None ]
        """
        from matplotlib.patches import Patch, Rectangle

        success = False
        if transform is None:
            if isinstance(path, Rectangle):
                self.clipbox = TransformedBbox(Bbox.unit(),
                                              path.get_transform())
                self._clippath = None
                success = True
            elif isinstance(path, Patch):
                self._clippath = TransformedPath(
                    path.get_path(),
                    path.get_transform())
                success = True
            elif isinstance(path, tuple):
                path, transform = path

        if path is None:
            self._clippath = None
            success = True
        elif isinstance(path, Path):
            self._clippath = TransformedPath(path, transform)
            success = True
        elif isinstance(path, TransformedPath):
            self._clippath = path
            success = True

        if not success:
            print(type(path), type(transform))
            raise TypeError("Invalid arguments to set_clip_path")

        self.pchanged()
开发者ID:BrenBarn,项目名称:matplotlib,代码行数:55,代码来源:artist.py


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