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

# 需要导入模块: 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)

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值