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

Function num2date

lib/matplotlib/dates.py:455–482  ·  view source on GitHub ↗

Convert Matplotlib dates to `~datetime.datetime` objects. Parameters ---------- x : float or sequence of floats Number of days (fraction part represents hours, minutes, seconds) since the epoch. See `.get_epoch` for the epoch, which can be changed by :rc:`d

(x, tz=None)

Source from the content-addressed store, hash-verified

453
454
455def num2date(x, tz=None):
456 """
457 Convert Matplotlib dates to `~datetime.datetime` objects.
458
459 Parameters
460 ----------
461 x : float or sequence of floats
462 Number of days (fraction part represents hours, minutes, seconds)
463 since the epoch. See `.get_epoch` for the
464 epoch, which can be changed by :rc:`date.epoch` or `.set_epoch`.
465 tz : str or `~datetime.tzinfo`, default: :rc:`timezone`
466 Timezone of *x*. If a string, *tz* is passed to `dateutil.tz`.
467
468 Returns
469 -------
470 `~datetime.datetime` or sequence of `~datetime.datetime`
471 Dates are returned in timezone *tz*.
472
473 If *x* is a sequence, a sequence of `~datetime.datetime` objects will
474 be returned.
475
476 Notes
477 -----
478 The Gregorian calendar is assumed; this is not universal practice.
479 For details, see the module docstring.
480 """
481 tz = _get_tzinfo(tz)
482 return _from_ordinalf_np_vectorized(x, tz).tolist()
483
484
485_ordinalf_to_timedelta_np_vectorized = np.vectorize(

Callers 5

__call__Method · 0.85
format_ticksMethod · 0.85
format_data_shortMethod · 0.85
datalim_to_dtMethod · 0.85
viewlim_to_dtMethod · 0.85

Calls 1

_get_tzinfoFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…