当前位置: 首页>>代码示例>>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;未经允许,请勿转载。