python transform方法_Python transforms.BboxTransformFrom方法代码示例

论坛 期权论坛 编程之家     
选择匿名的用户   2021-5-31 00:31   36   0

# 需要导入模块: from matplotlib import transforms [as 别名]

# 或者: from matplotlib.transforms import BboxTransformFrom [as 别名]

def _set_lim_and_transforms(self):

"""

set the *dataLim* and *viewLim*

:class:`~matplotlib.transforms.Bbox` attributes and the

*transScale*, *transData*, *transLimits* and *transAxes*

transformations.

.. note::

This method is primarily used by rectilinear projections

of the :class:`~matplotlib.axes.Axes` class, and is meant

to be overridden by new kinds of projection axes that need

different transformations and limits. (See

:class:`~matplotlib.projections.polar.PolarAxes` for an

example.

"""

self.transAxes = mtransforms.BboxTransformTo(self.bbox)

# Transforms the x and y axis separately by a scale factor.

# It is assumed that this part will have non-linear components

# (e.g., for a log scale).

self.transScale = mtransforms.TransformWrapper(

mtransforms.IdentityTransform())

# An affine transformation on the data, generally to limit the

# range of the axes

self.transLimits = mtransforms.BboxTransformFrom(

mtransforms.TransformedBbox(self.viewLim, self.transScale))

# The parentheses are important for efficiency here -- they

# group the last two (which are usually affines) separately

# from the first (which, with log-scaling can be non-affine).

self.transData = self.transScale + (self.transLimits + self.transAxes)

self._xaxis_transform = mtransforms.blended_transform_factory(

self.transData, self.transAxes)

self._yaxis_transform = mtransforms.blended_transform_factory(

self.transAxes, self.transData)

分享到 :
0 人收藏
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

积分:3875789
帖子:775174
精华:0
期权论坛 期权论坛
发布
内容

下载期权论坛手机APP