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


Python ScaledTranslation.to_values方法代码示例

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


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

示例1: PolarAxes

# 需要导入模块: from matplotlib.transforms import ScaledTranslation [as 别名]
# 或者: from matplotlib.transforms.ScaledTranslation import to_values [as 别名]

#.........这里部分代码省略.........
            self._theta_label2_position +
            self._xaxis_transform)

        # This is the transform for r-axis ticks.  It scales the theta
        # axis so the gridlines from 0.0 to 1.0, now go from 0.0 to
        # 2pi.
        self._yaxis_transform = (
            Affine2D().scale(np.pi * 2.0, 1.0) +
            self.transData)
        # The r-axis labels are put at an angle and padded in the r-direction
        self._r_label_position = ScaledTranslation(
            22.5, 0.0, Affine2D())
        self._yaxis_text_transform = (
            self._r_label_position +
            Affine2D().scale(1.0 / 360.0, 1.0) +
            self._yaxis_transform
            )

    def get_xaxis_transform(self,which='grid'):
        assert which in ['tick1','tick2','grid']
        return self._xaxis_transform

    def get_xaxis_text1_transform(self, pad):
        return self._xaxis_text1_transform, 'center', 'center'

    def get_xaxis_text2_transform(self, pad):
        return self._xaxis_text2_transform, 'center', 'center'

    def get_yaxis_transform(self,which='grid'):
        assert which in ['tick1','tick2','grid']
        return self._yaxis_transform

    def get_yaxis_text1_transform(self, pad):
        angle = self._r_label_position.to_values()[4]
        if angle < 90.:
            return self._yaxis_text_transform, 'bottom', 'left'
        elif angle < 180.:
            return self._yaxis_text_transform, 'bottom', 'right'
        elif angle < 270.:
            return self._yaxis_text_transform, 'top', 'right'
        else:
            return self._yaxis_text_transform, 'top', 'left'

    def get_yaxis_text2_transform(self, pad):
        angle = self._r_label_position.to_values()[4]
        if angle < 90.:
            return self._yaxis_text_transform, 'top', 'right'
        elif angle < 180.:
            return self._yaxis_text_transform, 'top', 'left'
        elif angle < 270.:
            return self._yaxis_text_transform, 'bottom', 'left'
        else:
            return self._yaxis_text_transform, 'bottom', 'right'

    def _gen_axes_patch(self):
        return Circle((0.5, 0.5), 0.5)

    def _gen_axes_spines(self):
        return {'polar':mspines.Spine.circular_spine(self,
                                                     (0.5, 0.5), 0.5)}

    def set_rmax(self, rmax):
        self.viewLim.y1 = rmax

    def get_rmax(self):
        return self.viewLim.ymax
开发者ID:EnochManohar,项目名称:matplotlib,代码行数:70,代码来源:polar.py

示例2: PolarAxes

# 需要导入模块: from matplotlib.transforms import ScaledTranslation [as 别名]
# 或者: from matplotlib.transforms.ScaledTranslation import to_values [as 别名]

#.........这里部分代码省略.........
            self._theta_label2_position +
            self._xaxis_transform)

        # This is the transform for r-axis ticks.  It scales the theta
        # axis so the gridlines from 0.0 to 1.0, now go from 0.0 to
        # 2pi.
        self._yaxis_transform = (
            Affine2D().scale(np.pi * 2.0, 1.0) +
            self.transData)
        # The r-axis labels are put at an angle and padded in the r-direction
        self._r_label_position = ScaledTranslation(
            22.5, 0.0, Affine2D())
        self._yaxis_text_transform = (
            self._r_label_position +
            Affine2D().scale(1.0 / 360.0, 1.0) +
            self._yaxis_transform
            )

    def get_xaxis_transform(self,which='grid'):
        assert which in ['tick1','tick2','grid']
        return self._xaxis_transform

    def get_xaxis_text1_transform(self, pad):
        return self._xaxis_text1_transform, 'center', 'center'

    def get_xaxis_text2_transform(self, pad):
        return self._xaxis_text2_transform, 'center', 'center'

    def get_yaxis_transform(self,which='grid'):
        assert which in ['tick1','tick2','grid']
        return self._yaxis_transform

    def get_yaxis_text1_transform(self, pad):
        angle = self._r_label_position.to_values()[4]
        if angle < 90.:
            return self._yaxis_text_transform, 'bottom', 'left'
        elif angle < 180.:
            return self._yaxis_text_transform, 'bottom', 'right'
        elif angle < 270.:
            return self._yaxis_text_transform, 'top', 'right'
        else:
            return self._yaxis_text_transform, 'top', 'left'

    def get_yaxis_text2_transform(self, pad):
        angle = self._r_label_position.to_values()[4]
        if angle < 90.:
            return self._yaxis_text_transform, 'top', 'right'
        elif angle < 180.:
            return self._yaxis_text_transform, 'top', 'left'
        elif angle < 270.:
            return self._yaxis_text_transform, 'bottom', 'left'
        else:
            return self._yaxis_text_transform, 'bottom', 'right'

    def _gen_axes_patch(self):
        return Circle((0.5, 0.5), 0.5)

    def _gen_axes_spines(self):
        return {'polar':mspines.Spine.circular_spine(self,
                                                     (0.5, 0.5), 0.5)}

    def set_rmax(self, rmax):
        self.viewLim.y1 = rmax

    def get_rmax(self):
        return self.viewLim.ymax
开发者ID:123jefferson,项目名称:MiniBloq-Sparki,代码行数:70,代码来源:polar.py


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