Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 7f2188a

Browse files
committed
Tweak Formatter method docstrings.
In particular, make it explicit which methods are used for what purpose.
1 parent a85564e commit 7f2188a

1 file changed

Lines changed: 13 additions & 4 deletions

File tree

lib/matplotlib/ticker.py

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -206,13 +206,18 @@ class Formatter(TickHelper):
206206

207207
def __call__(self, x, pos=None):
208208
"""
209-
Return the format for tick value *x* at position pos.
209+
Return the format for tick value *x* at index *pos*.
210210
``pos=None`` indicates an unspecified location.
211211
"""
212212
raise NotImplementedError('Derived must override')
213213

214214
def format_ticks(self, values):
215-
"""Return the tick labels for all the ticks at once."""
215+
"""
216+
Return the tick labels strings for all *values*.
217+
218+
This method is the public API to generate a meaningful format for a set
219+
of values, e.g. by ensuring an appropriate precision.
220+
"""
216221
self.set_locs(values)
217222
return [self(value, i) for i, value in enumerate(values)]
218223

@@ -225,9 +230,13 @@ def format_data(self, value):
225230

226231
def format_data_short(self, value):
227232
"""
228-
Return a short string version of the tick value.
233+
Return the mouseover-text representation of a value.
234+
235+
This defaults to the representation returned by `.Formatter.format_data`,
236+
but subclasses may override this.
229237
230-
Defaults to the position-independent long value.
238+
Note: The mouseover text can be customized by setting the
239+
``Axes.fmt_xdata`` and ``Axes.fmt_ydata`` attributes.
231240
"""
232241
return self.format_data(value)
233242

0 commit comments

Comments
 (0)