(self, formatter, level)
| 2092 | self._set_formatter(formatter, self.minor) |
| 2093 | |
| 2094 | def _set_formatter(self, formatter, level): |
| 2095 | if isinstance(formatter, str): |
| 2096 | formatter = mticker.StrMethodFormatter(formatter) |
| 2097 | # Don't allow any other TickHelper to avoid easy-to-make errors, |
| 2098 | # like using a Locator instead of a Formatter. |
| 2099 | elif (callable(formatter) and |
| 2100 | not isinstance(formatter, mticker.TickHelper)): |
| 2101 | formatter = mticker.FuncFormatter(formatter) |
| 2102 | else: |
| 2103 | _api.check_isinstance(mticker.Formatter, formatter=formatter) |
| 2104 | |
| 2105 | if (isinstance(formatter, mticker.FixedFormatter) |
| 2106 | and len(formatter.seq) > 0 |
| 2107 | and not isinstance(level.locator, mticker.FixedLocator) |
| 2108 | and not (hasattr(level.locator, 'base') and |
| 2109 | isinstance(level.locator.base, mticker.FixedLocator))): |
| 2110 | _api.warn_external('FixedFormatter should only be used together ' |
| 2111 | 'with FixedLocator') |
| 2112 | |
| 2113 | if level == self.major: |
| 2114 | self.isDefault_majfmt = False |
| 2115 | else: |
| 2116 | self.isDefault_minfmt = False |
| 2117 | |
| 2118 | level.formatter = formatter |
| 2119 | formatter.set_axis(self) |
| 2120 | self.stale = True |
| 2121 | |
| 2122 | def set_major_locator(self, locator): |
| 2123 | """ |
no test coverage detected