當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。