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

Class DateFormatter

lib/matplotlib/dates.py:565–592  ·  view source on GitHub ↗

Format a tick (in days since the epoch) with a `~datetime.datetime.strftime` format string.

Source from the content-addressed store, hash-verified

563
564
565class 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
595class ConciseDateFormatter(ticker.Formatter):

Callers 7

plot_axisFunction · 0.90
date_demo_rrule.pyFile · 0.90
__call__Method · 0.85
__init__Method · 0.85
__call__Method · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…