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


Python Bbox.unit方法代码示例

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


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

示例1: _set_lim_and_transforms

# 需要导入模块: from matplotlib.transforms import Bbox [as 别名]
# 或者: from matplotlib.transforms.Bbox import unit [as 别名]
def _set_lim_and_transforms(self):
        """
        """
        PolarAxes._set_lim_and_transforms(self)
        self.transProjection = self.DipPolarTransform()
        # pylint: attribute-defined-outside-init,invalid-name
        self.transData = (
            self.transScale +
            self.transProjection +
            (self.transProjectionAffine + self.transAxes))
        # pylint: attribute-defined-outside-init,invalid-name
        self._xaxis_transform = (
            self.transProjection +
            self.PolarAffine(IdentityTransform(), Bbox.unit()) +
            self.transAxes)  # pylint: attribute-defined-outside-init
        self._xaxis_text1_transform = (
            self._theta_label1_position +
            self._xaxis_transform)  # pylint: attribute-defined-outside-init
        self._yaxis_transform = (
            Affine2D().scale(np.pi * 2.0, 1.0) +
            self.transData)  # pylint: attribute-defined-outside-init
        self._yaxis_text1_transform = (
            Affine2D().scale(1.0 / 360.0, 1.0) +
            self._yaxis_transform)  # pylint: attribute-defined-outside-init 
开发者ID:innstereo,项目名称:innstereo,代码行数:26,代码来源:polar_axes.py

示例2: _get_xy_display

# 需要导入模块: from matplotlib.transforms import Bbox [as 别名]
# 或者: from matplotlib.transforms.Bbox import unit [as 别名]
def _get_xy_display(self):
        'get the (possibly unit converted) transformed x, y in display coords'
        x, y = self.get_position()
        return self.get_transform().transform_point((x, y)) 
开发者ID:ktraunmueller,项目名称:Computable,代码行数:6,代码来源:text.py

示例3: __init__

# 需要导入模块: from matplotlib.transforms import Bbox [as 别名]
# 或者: from matplotlib.transforms.Bbox import unit [as 别名]
def __init__(self, artist, ref_coord, unit="points"):
        self._artist = artist
        self._ref_coord = ref_coord
        self.set_unit(unit) 
开发者ID:ktraunmueller,项目名称:Computable,代码行数:6,代码来源:text.py

示例4: set_unit

# 需要导入模块: from matplotlib.transforms import Bbox [as 别名]
# 或者: from matplotlib.transforms.Bbox import unit [as 别名]
def set_unit(self, unit):
        assert unit in ["points", "pixels"]
        self._unit = unit 
开发者ID:ktraunmueller,项目名称:Computable,代码行数:5,代码来源:text.py

示例5: _get_scale

# 需要导入模块: from matplotlib.transforms import Bbox [as 别名]
# 或者: from matplotlib.transforms.Bbox import unit [as 别名]
def _get_scale(self, renderer):
        unit = self.get_unit()
        if unit == "pixels":
            return 1.
        else:
            return renderer.points_to_pixels(1.) 
开发者ID:ktraunmueller,项目名称:Computable,代码行数:8,代码来源:text.py

示例6: get_window_extent

# 需要导入模块: from matplotlib.transforms import Bbox [as 别名]
# 或者: from matplotlib.transforms.Bbox import unit [as 别名]
def get_window_extent(self, renderer=None, dpi=None):
        '''
        Return a :class:`~matplotlib.transforms.Bbox` object bounding
        the text, in display units.

        In addition to being used internally, this is useful for
        specifying clickable regions in a png file on a web page.

        *renderer* defaults to the _renderer attribute of the text
        object.  This is not assigned until the first execution of
        :meth:`draw`, so you must use this kwarg if you want
        to call :meth:`get_window_extent` prior to the first
        :meth:`draw`.  For getting web page regions, it is
        simpler to call the method after saving the figure.

        *dpi* defaults to self.figure.dpi; the renderer dpi is
        irrelevant.  For the web application, if figure.dpi is not
        the value used when saving the figure, then the value that
        was used must be specified as the *dpi* argument.
        '''
        #return _unit_box
        if not self.get_visible():
            return Bbox.unit()
        if dpi is not None:
            dpi_orig = self.figure.dpi
            self.figure.dpi = dpi
        if self.get_text().strip() == '':
            tx, ty = self._get_xy_display()
            return Bbox.from_bounds(tx, ty, 0, 0)

        if renderer is not None:
            self._renderer = renderer
        if self._renderer is None:
            raise RuntimeError('Cannot get window extent w/o renderer')

        bbox, info, descent = self._get_layout(self._renderer)
        x, y = self.get_position()
        x, y = self.get_transform().transform_point((x, y))
        bbox = bbox.translated(x, y)
        if dpi is not None:
            self.figure.dpi = dpi_orig
        return bbox 
开发者ID:ktraunmueller,项目名称:Computable,代码行数:44,代码来源:text.py


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