In particular, I don't think set_locs is needed publically. Calling format_ticks(values) should be sufficent and it should be possible to make the locs state an implementation detail.
Additionally, one could check / clarify the relation of __call__ and format_data. Are both needed publically?
This is a tracking item for the idea. It's not yet ready to be worked on, because we first need a deeper analysis on the current usage and a discussion on the desired API.
Possible improvements:
Distinguish between configuration (e.g. base for LogFormatter) and context. Context is information extracted from a set of tick values that may influence how single ticks are rendered (e.g. precision or offset). The context is currently partly public. As a first step, we can make the context private (MNT: Privatize Formatter attributes #31416). This will open up possibilities for re-architecting internal logic: Currently context is stored as persistent state on the Formatter, but we may be able to remove this state (will also require making set_locs() private.
Activity
DOC: Improve Formatter documentation
DOC: Improve Formatter documentation
DOC: Improve Formatter documentation
DOC: Improve Formatter documentation