當前位置: 首頁>>代碼示例>>Python>>正文


Python ticker.Formatter方法代碼示例

本文整理匯總了Python中matplotlib.ticker.Formatter方法的典型用法代碼示例。如果您正苦於以下問題:Python ticker.Formatter方法的具體用法?Python ticker.Formatter怎麽用?Python ticker.Formatter使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在matplotlib.ticker的用法示例。


在下文中一共展示了ticker.Formatter方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: autoscale

# 需要導入模塊: from matplotlib import ticker [as 別名]
# 或者: from matplotlib.ticker import Formatter [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: autoscale

# 需要導入模塊: from matplotlib import ticker [as 別名]
# 或者: from matplotlib.ticker import Formatter [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

示例3: set_default_locators_and_formatters

# 需要導入模塊: from matplotlib import ticker [as 別名]
# 或者: from matplotlib.ticker import Formatter [as 別名]
def set_default_locators_and_formatters(self, axis):
        """
        Override to set up the locators and formatters to use with the
        scale.  This is only required if the scale requires custom
        locators and formatters.  Writing custom locators and
        formatters is rather outside the scope of this example, but
        there are many helpful examples in ``ticker.py``.

        In our case, the Mercator example uses a fixed locator from
        -90 to 90 degrees and a custom formatter class to put convert
        the radians to degrees and put a degree symbol after the
        value::
        """
        class DegreeFormatter(Formatter):
            def __call__(self, x, pos=None):
                return "%d\N{DEGREE SIGN}" % np.degrees(x)

        axis.set_major_locator(FixedLocator(
            np.radians(np.arange(-90, 90, 10))))
        axis.set_major_formatter(DegreeFormatter())
        axis.set_minor_formatter(DegreeFormatter()) 
開發者ID:holzschu,項目名稱:python3_ios,代碼行數:23,代碼來源:custom_scale.py

示例4: wrap_formatter

# 需要導入模塊: from matplotlib import ticker [as 別名]
# 或者: from matplotlib.ticker import Formatter [as 別名]
def wrap_formatter(formatter):
    """
    Wraps formatting function or string in
    appropriate matplotlib formatter type.
    """
    if isinstance(formatter, ticker.Formatter):
        return formatter
    elif callable(formatter):
        args = [arg for arg in _getargspec(formatter).args
                if arg != 'self']
        wrapped = formatter
        if len(args) == 1:
            def wrapped(val, pos=None):
                return formatter(val)
        return ticker.FuncFormatter(wrapped)
    elif isinstance(formatter, basestring):
        if re.findall(r"\{(\w+)\}", formatter):
            return ticker.StrMethodFormatter(formatter)
        else:
            return ticker.FormatStrFormatter(formatter) 
開發者ID:holoviz,項目名稱:holoviews,代碼行數:22,代碼來源:util.py

示例5: set_major_formatter

# 需要導入模塊: from matplotlib import ticker [as 別名]
# 或者: from matplotlib.ticker import Formatter [as 別名]
def set_major_formatter(self, formatter):
        """
        Set the formatter to use for the major tick labels.

        Parameters
        ----------
        formatter : str or Formatter
            The format or formatter to use.
        """
        if isinstance(formatter, Formatter):
            raise NotImplementedError()  # figure out how to swap out formatter
        elif isinstance(formatter, str):
            self._formatter_locator.format = formatter
        else:
            raise TypeError("formatter should be a string or a Formatter "
                            "instance") 
開發者ID:holzschu,項目名稱:Carnets,代碼行數:18,代碼來源:coordinate_helpers.py

示例6: set_major_formatter

# 需要導入模塊: from matplotlib import ticker [as 別名]
# 或者: from matplotlib.ticker import Formatter [as 別名]
def set_major_formatter(self, formatter):
        """
        Set the formatter of the major ticker.

        Parameters
        ----------
        formatter : ~matplotlib.ticker.Formatter
        """
        if not isinstance(formatter, mticker.Formatter):
            raise TypeError("formatter argument should be instance of "
                    "matplotlib.ticker.Formatter")
        self.isDefault_majfmt = False
        self.major.formatter = formatter
        formatter.set_axis(self)
        self.stale = True 
開發者ID:PacktPublishing,項目名稱:Mastering-Elasticsearch-7.0,代碼行數:17,代碼來源:axis.py

示例7: set_minor_formatter

# 需要導入模塊: from matplotlib import ticker [as 別名]
# 或者: from matplotlib.ticker import Formatter [as 別名]
def set_minor_formatter(self, formatter):
        """
        Set the formatter of the minor ticker.

        Parameters
        ----------
        formatter : ~matplotlib.ticker.Formatter
        """
        if not isinstance(formatter, mticker.Formatter):
            raise TypeError("formatter argument should be instance of "
                            "matplotlib.ticker.Formatter")
        self.isDefault_minfmt = False
        self.minor.formatter = formatter
        formatter.set_axis(self)
        self.stale = True 
開發者ID:PacktPublishing,項目名稱:Mastering-Elasticsearch-7.0,代碼行數:17,代碼來源:axis.py

示例8: set_minor_formatter

# 需要導入模塊: from matplotlib import ticker [as 別名]
# 或者: from matplotlib.ticker import Formatter [as 別名]
def set_minor_formatter(self, formatter):
        """
        Set the formatter of the minor ticker.

        Parameters
        ----------
        formatter : ~matplotlib.ticker.Formatter
        """
        if not isinstance(formatter, mticker.Formatter):
            raise TypeError("formatter argument should be instance of "
                    "matplotlib.ticker.Formatter")
        self.isDefault_minfmt = False
        self.minor.formatter = formatter
        formatter.set_axis(self)
        self.stale = True 
開發者ID:Relph1119,項目名稱:GraphicDesignPatternByPython,代碼行數:17,代碼來源:axis.py

示例9: set_major_formatter

# 需要導入模塊: from matplotlib import ticker [as 別名]
# 或者: from matplotlib.ticker import Formatter [as 別名]
def set_major_formatter(self, formatter):
        """
        Set the formatter of the major ticker.

        Parameters
        ----------
        formatter : `~matplotlib.ticker.Formatter`
        """
        if not isinstance(formatter, mticker.Formatter):
            raise TypeError("formatter argument should be instance of "
                    "matplotlib.ticker.Formatter")
        self.isDefault_majfmt = False
        self.major.formatter = formatter
        formatter.set_axis(self)
        self.stale = True 
開發者ID:boris-kz,項目名稱:CogAlg,代碼行數:17,代碼來源:axis.py

示例10: set_minor_formatter

# 需要導入模塊: from matplotlib import ticker [as 別名]
# 或者: from matplotlib.ticker import Formatter [as 別名]
def set_minor_formatter(self, formatter):
        """
        Set the formatter of the minor ticker.

        Parameters
        ----------
        formatter : `~matplotlib.ticker.Formatter`
        """
        if not isinstance(formatter, mticker.Formatter):
            raise TypeError("formatter argument should be instance of "
                            "matplotlib.ticker.Formatter")
        self.isDefault_minfmt = False
        self.minor.formatter = formatter
        formatter.set_axis(self)
        self.stale = True 
開發者ID:boris-kz,項目名稱:CogAlg,代碼行數:17,代碼來源:axis.py


注:本文中的matplotlib.ticker.Formatter方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。