Format a tick (in days since the epoch) with a `~datetime.datetime.strftime` format string.
| 563 | |
| 564 | |
| 565 | class DateFormatter(ticker.Formatter): |
| 566 | """ |
| 567 | Format a tick (in days since the epoch) with a |
| 568 | `~datetime.datetime.strftime` format string. |
| 569 | """ |
| 570 | |
| 571 | def __init__(self, fmt, tz=None, *, usetex=None): |
| 572 | """ |
| 573 | Parameters |
| 574 | ---------- |
| 575 | fmt : str |
| 576 | `~datetime.datetime.strftime` format string |
| 577 | tz : str or `~datetime.tzinfo`, default: :rc:`timezone` |
| 578 | Ticks timezone. If a string, *tz* is passed to `dateutil.tz`. |
| 579 | usetex : bool, default: :rc:`text.usetex` |
| 580 | To enable/disable the use of TeX's math mode for rendering the |
| 581 | results of the formatter. |
| 582 | """ |
| 583 | self.tz = _get_tzinfo(tz) |
| 584 | self.fmt = fmt |
| 585 | self._usetex = mpl._val_or_rc(usetex, 'text.usetex') |
| 586 | |
| 587 | def __call__(self, x, pos=0): |
| 588 | result = num2date(x, self.tz).strftime(self.fmt) |
| 589 | return _wrap_in_tex(result) if self._usetex else result |
| 590 | |
| 591 | def set_tzinfo(self, tz): |
| 592 | self.tz = _get_tzinfo(tz) |
| 593 | |
| 594 | |
| 595 | class ConciseDateFormatter(ticker.Formatter): |
no outgoing calls
no test coverage detected
searching dependent graphs…