MCPcopy Index your code
hub / github.com/matplotlib/matplotlib / set_major_formatter

Method set_major_formatter

lib/matplotlib/axis.py:2054–2078  ·  view source on GitHub ↗

Set the formatter of the major ticker. In addition to a `~matplotlib.ticker.Formatter` instance, this also accepts a ``str`` or function. For a ``str`` a `~matplotlib.ticker.StrMethodFormatter` is used. The field used for the value must be labeled ``'x'`` a

(self, formatter)

Source from the content-addressed store, hash-verified

2052 return self.label
2053
2054 def set_major_formatter(self, formatter):
2055 """
2056 Set the formatter of the major ticker.
2057
2058 In addition to a `~matplotlib.ticker.Formatter` instance,
2059 this also accepts a ``str`` or function.
2060
2061 For a ``str`` a `~matplotlib.ticker.StrMethodFormatter` is used.
2062 The field used for the value must be labeled ``'x'`` and the field used
2063 for the position must be labeled ``'pos'``.
2064 See the `~matplotlib.ticker.StrMethodFormatter` documentation for
2065 more information.
2066
2067 For a function, a `~matplotlib.ticker.FuncFormatter` is used.
2068 The function must take two inputs (a tick value ``x`` and a
2069 position ``pos``), and return a string containing the corresponding
2070 tick label.
2071 See the `~matplotlib.ticker.FuncFormatter` documentation for
2072 more information.
2073
2074 Parameters
2075 ----------
2076 formatter : `~matplotlib.ticker.Formatter`, ``str``, or function
2077 """
2078 self._set_formatter(formatter, self.major)
2079
2080 def set_minor_formatter(self, formatter):
2081 """

Calls 1

_set_formatterMethod · 0.95

Tested by 1

test_scale3d_log_basesFunction · 0.36