def tsfmt(x, pos): dt = mdates._from_ordinalf(x) dt = dt.astimezone(mytz) if dt.hour == 0: fmt = "%-I %p\n%-d %b" else: fmt = "%-I %p" return dt.strftime(fmt)
def tsfmt(x, pos): """Timestamp formatter""" dt = mdates._from_ordinalf(x) dt = dt.astimezone(mytz) if dt.hour == 0: fmt = "%-I %p\n%-d %b" else: fmt = "%-I %p" return dt.strftime(fmt)
def from_ordinal(x): return mdates._from_ordinalf(x).astimezone(utc).replace(tzinfo=None)