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

Method __init__

lib/matplotlib/dates.py:880–917  ·  view source on GitHub ↗

Autoformat the date labels. Parameters ---------- locator : `.ticker.Locator` Locator that this axis is using. tz : str or `~datetime.tzinfo`, default: :rc:`timezone` Ticks timezone. If a string, *tz* is passed to `dateutil.tz`.

(self, locator, tz=None, defaultfmt='%Y-%m-%d', *,
                 usetex=None)

Source from the content-addressed store, hash-verified

878 # possibility...
879
880 def __init__(self, locator, tz=None, defaultfmt='%Y-%m-%d', *,
881 usetex=None):
882 """
883 Autoformat the date labels.
884
885 Parameters
886 ----------
887 locator : `.ticker.Locator`
888 Locator that this axis is using.
889
890 tz : str or `~datetime.tzinfo`, default: :rc:`timezone`
891 Ticks timezone. If a string, *tz* is passed to `dateutil.tz`.
892
893 defaultfmt : str
894 The default format to use if none of the values in ``self.scaled``
895 are greater than the unit returned by ``locator._get_unit()``.
896
897 usetex : bool, default: :rc:`text.usetex`
898 To enable/disable the use of TeX's math mode for rendering the
899 results of the formatter. If any entries in ``self.scaled`` are set
900 as functions, then it is up to the customized function to enable or
901 disable TeX's math mode itself.
902 """
903 self._locator = locator
904 self._tz = tz
905 self.defaultfmt = defaultfmt
906 self._formatter = DateFormatter(self.defaultfmt, tz)
907 rcParams = mpl.rcParams
908 self._usetex = mpl._val_or_rc(usetex, 'text.usetex')
909 self.scaled = {
910 DAYS_PER_YEAR: rcParams['date.autoformatter.year'],
911 DAYS_PER_MONTH: rcParams['date.autoformatter.month'],
912 1: rcParams['date.autoformatter.day'],
913 1 / HOURS_PER_DAY: rcParams['date.autoformatter.hour'],
914 1 / MINUTES_PER_DAY: rcParams['date.autoformatter.minute'],
915 1 / SEC_PER_DAY: rcParams['date.autoformatter.second'],
916 1 / MUSECONDS_PER_DAY: rcParams['date.autoformatter.microsecond']
917 }
918
919 def _set_locator(self, locator):
920 self._locator = locator

Callers

nothing calls this directly

Calls 1

DateFormatterClass · 0.85

Tested by

no test coverage detected