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


Python transforms.nonsingular方法代码示例

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


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

示例1: autoscale

# 需要导入模块: from matplotlib import transforms [as 别名]
# 或者: from matplotlib.transforms import nonsingular [as 别名]
def autoscale(self):
        """
        Sets the view limits to the nearest multiples of base that contain the
        data.
        """
        # requires matplotlib >= 0.98.0
        (vmin, vmax) = self.axis.get_data_interval()

        locs = self._get_default_locs(vmin, vmax)
        (vmin, vmax) = locs[[0, -1]]
        if vmin == vmax:
            vmin -= 1
            vmax += 1
        return nonsingular(vmin, vmax)

# -------------------------------------------------------------------------
# --- Formatter ---
# ------------------------------------------------------------------------- 
开发者ID:Frank-qlu,项目名称:recruit,代码行数:20,代码来源:_converter.py

示例2: pan

# 需要导入模块: from matplotlib import transforms [as 别名]
# 或者: from matplotlib.transforms import nonsingular [as 别名]
def pan(self, numsteps):
        """Pan numticks (can be positive or negative)"""
        ticks = self()
        numticks = len(ticks)

        vmin, vmax = self.axis.get_view_interval()
        vmin, vmax = mtransforms.nonsingular(vmin, vmax, expander=0.05)
        if numticks > 2:
            step = numsteps * abs(ticks[0] - ticks[1])
        else:
            d = abs(vmax - vmin)
            step = numsteps * d / 6.

        vmin += step
        vmax += step
        self.axis.set_view_interval(vmin, vmax, ignore=True) 
开发者ID:ktraunmueller,项目名称:Computable,代码行数:18,代码来源:ticker.py

示例3: tick_values

# 需要导入模块: from matplotlib import transforms [as 别名]
# 或者: from matplotlib.transforms import nonsingular [as 别名]
def tick_values(self, vmin, vmax):
        vmin, vmax = mtransforms.nonsingular(vmin, vmax, expander=0.05)
        if vmax < vmin:
            vmin, vmax = vmax, vmin

        if (vmin, vmax) in self.presets:
            return self.presets[(vmin, vmax)]

        if self.numticks is None:
            self._set_numticks()

        if self.numticks == 0:
            return []
        ticklocs = np.linspace(vmin, vmax, self.numticks)

        return self.raise_if_exceeds(ticklocs) 
开发者ID:ktraunmueller,项目名称:Computable,代码行数:18,代码来源:ticker.py

示例4: scale_range

# 需要导入模块: from matplotlib import transforms [as 别名]
# 或者: from matplotlib.transforms import nonsingular [as 别名]
def scale_range(vmin, vmax, n=1, threshold=100):
    dv = abs(vmax - vmin)
    if dv == 0:     # maxabsv == 0 is a special case of this.
        return 1.0, 0.0
        # Note: this should never occur because
        # vmin, vmax should have been checked by nonsingular(),
        # and spread apart if necessary.
    meanv = 0.5 * (vmax + vmin)
    if abs(meanv) / dv < threshold:
        offset = 0
    elif meanv > 0:
        ex = divmod(math.log10(meanv), 1)[0]
        offset = 10 ** ex
    else:
        ex = divmod(math.log10(-meanv), 1)[0]
        offset = -10 ** ex
    ex = divmod(math.log10(dv / n), 1)[0]
    scale = 10 ** ex
    return scale, offset 
开发者ID:ktraunmueller,项目名称:Computable,代码行数:21,代码来源:ticker.py

示例5: autoscale

# 需要导入模块: from matplotlib import transforms [as 别名]
# 或者: from matplotlib.transforms import nonsingular [as 别名]
def autoscale(self):
        """
        Sets the view limits to the nearest multiples of base that contain the
        data.
        """
        # requires matplotlib >= 0.98.0
        (vmin, vmax) = self.axis.get_data_interval()

        locs = self._get_default_locs(vmin, vmax)
        (vmin, vmax) = locs[[0, -1]]
        if vmin == vmax:
            vmin -= 1
            vmax += 1
        return nonsingular(vmin, vmax)

#####-------------------------------------------------------------------------
#---- --- Formatter ---
#####------------------------------------------------------------------------- 
开发者ID:ktraunmueller,项目名称:Computable,代码行数:20,代码来源:converter.py

示例6: __call__

# 需要导入模块: from matplotlib import transforms [as 别名]
# 或者: from matplotlib.transforms import nonsingular [as 别名]
def __call__(self, x, pos=None):
        """
        Return the format for tick val *x*.
        """
        if x == 0.0:  # Symlog
            return '0'

        x = abs(x)
        b = self._base
        # only label the decades
        fx = math.log(x) / math.log(b)
        is_x_decade = is_close_to_int(fx)
        exponent = np.round(fx) if is_x_decade else np.floor(fx)
        coeff = np.round(x / b ** exponent)

        if self.labelOnlyBase and not is_x_decade:
            return ''
        if self._sublabels is not None and coeff not in self._sublabels:
            return ''

        vmin, vmax = self.axis.get_view_interval()
        vmin, vmax = mtransforms.nonsingular(vmin, vmax, expander=0.05)
        s = self._num_to_string(x, vmin, vmax)
        return self.fix_minus(s) 
开发者ID:PacktPublishing,项目名称:Mastering-Elasticsearch-7.0,代码行数:26,代码来源:ticker.py

示例7: view_limits

# 需要导入模块: from matplotlib import transforms [as 别名]
# 或者: from matplotlib.transforms import nonsingular [as 别名]
def view_limits(self, vmin, vmax):
        'Try to choose the view limits intelligently'

        if vmax < vmin:
            vmin, vmax = vmax, vmin

        if vmin == vmax:
            vmin -= 1
            vmax += 1

        if rcParams['axes.autolimit_mode'] == 'round_numbers':
            exponent, remainder = divmod(
                math.log10(vmax - vmin), math.log10(max(self.numticks - 1, 1)))
            exponent -= (remainder < .5)
            scale = max(self.numticks - 1, 1) ** (-exponent)
            vmin = math.floor(scale * vmin) / scale
            vmax = math.ceil(scale * vmax) / scale

        return mtransforms.nonsingular(vmin, vmax) 
开发者ID:PacktPublishing,项目名称:Mastering-Elasticsearch-7.0,代码行数:21,代码来源:ticker.py

示例8: tick_values

# 需要导入模块: from matplotlib import transforms [as 别名]
# 或者: from matplotlib.transforms import nonsingular [as 别名]
def tick_values(self, vmin, vmax):
        if self._symmetric:
            vmax = max(abs(vmin), abs(vmax))
            vmin = -vmax
        vmin, vmax = mtransforms.nonsingular(
            vmin, vmax, expander=1e-13, tiny=1e-14)
        locs = self._raw_ticks(vmin, vmax)

        prune = self._prune
        if prune == 'lower':
            locs = locs[1:]
        elif prune == 'upper':
            locs = locs[:-1]
        elif prune == 'both':
            locs = locs[1:-1]
        return self.raise_if_exceeds(locs) 
开发者ID:PacktPublishing,项目名称:Mastering-Elasticsearch-7.0,代码行数:18,代码来源:ticker.py

示例9: nonsingular

# 需要导入模块: from matplotlib import transforms [as 别名]
# 或者: from matplotlib.transforms import nonsingular [as 别名]
def nonsingular(self, vmin, vmax):
        if not np.isfinite(vmin) or not np.isfinite(vmax):
            return 1, 10  # initial range, no data plotted yet

        if vmin > vmax:
            vmin, vmax = vmax, vmin
        if vmax <= 0:
            cbook._warn_external(
                "Data has no positive values, and therefore cannot be "
                "log-scaled.")
            return 1, 10

        minpos = self.axis.get_minpos()
        if not np.isfinite(minpos):
            minpos = 1e-300  # This should never take effect.
        if vmin <= 0:
            vmin = minpos
        if vmin == vmax:
            vmin = _decade_less(vmin, self._base)
            vmax = _decade_greater(vmax, self._base)
        return vmin, vmax 
开发者ID:PacktPublishing,项目名称:Mastering-Elasticsearch-7.0,代码行数:23,代码来源:ticker.py

示例10: __call__

# 需要导入模块: from matplotlib import transforms [as 别名]
# 或者: from matplotlib.transforms import nonsingular [as 别名]
def __call__(self, x, pos=None):
        """Return the format for tick val *x* at position *pos*"""

        vmin, vmax = self.axis.get_view_interval()
        vmin, vmax = mtransforms.nonsingular(vmin, vmax, expander=0.05)
        d = abs(vmax - vmin)
        b = self._base
        if x == 0:
            return '0'
        sign = np.sign(x)
        # only label the decades
        fx = math.log(abs(x)) / math.log(b)
        isDecade = is_close_to_int(fx)
        if not isDecade and self.labelOnlyBase:
            s = ''
        elif abs(fx) > 10000:
            s = '%1.0g' % fx
        elif abs(fx) < 1:
            s = '%1.0g' % fx
        else:
            s = self.pprint_val(fx, d)
        if sign == -1:
            s = '-%s' % s

        return self.fix_minus(s) 
开发者ID:miloharper,项目名称:neural-network-animation,代码行数:27,代码来源:ticker.py

示例11: view_limits

# 需要导入模块: from matplotlib import transforms [as 别名]
# 或者: from matplotlib.transforms import nonsingular [as 别名]
def view_limits(self, dmin, dmax):
        """
        Set the view limits to the nearest multiples of base that
        contain the data.
        """
        if rcParams['axes.autolimit_mode'] == 'round_numbers':
            vmin = self._edge.le(dmin) * self._edge.step
            vmax = self._base.ge(dmax) * self._edge.step
            if vmin == vmax:
                vmin -= 1
                vmax += 1
        else:
            vmin = dmin
            vmax = dmax

        return mtransforms.nonsingular(vmin, vmax) 
开发者ID:Relph1119,项目名称:GraphicDesignPatternByPython,代码行数:18,代码来源:ticker.py

示例12: __call__

# 需要导入模块: from matplotlib import transforms [as 别名]
# 或者: from matplotlib.transforms import nonsingular [as 别名]
def __call__(self, x, pos=None):
        """Return the format for tick val *x* at position *pos*"""

        vmin, vmax = self.axis.get_view_interval()
        vmin, vmax = mtransforms.nonsingular(vmin, vmax, expander=0.05)
        d = abs(vmax - vmin)
        b = self._base
        if x == 0:
            return '0'
        sign = np.sign(x)
        # only label the decades
        fx = math.log(abs(x)) / math.log(b)
        isDecade = is_close_to_int(fx)
        if not isDecade and self.labelOnlyBase:
            s = ''
        #if 0: pass
        elif fx > 10000:
            s = '%1.0e' % fx
        #elif x<1: s = '$10^{%d}$'%fx
        #elif x<1: s =  '10^%d'%fx
        elif fx < 1:
            s = '%1.0e' % fx
        else:
            s = self.pprint_val(fx, d)
        if sign == -1:
            s = '-%s' % s

        return self.fix_minus(s) 
开发者ID:ktraunmueller,项目名称:Computable,代码行数:30,代码来源:ticker.py


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