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

Function drange

lib/matplotlib/dates.py:508–546  ·  view source on GitHub ↗

Return a sequence of equally spaced Matplotlib dates. The dates start at *dstart* and reach up to, but not including *dend*. They are spaced by *delta*. Parameters ---------- dstart, dend : `~datetime.datetime` The date limits. delta : `datetime.timedelta`

(dstart, dend, delta)

Source from the content-addressed store, hash-verified

506
507
508def drange(dstart, dend, delta):
509 """
510 Return a sequence of equally spaced Matplotlib dates.
511
512 The dates start at *dstart* and reach up to, but not including *dend*.
513 They are spaced by *delta*.
514
515 Parameters
516 ----------
517 dstart, dend : `~datetime.datetime`
518 The date limits.
519 delta : `datetime.timedelta`
520 Spacing of the dates.
521
522 Returns
523 -------
524 `numpy.array`
525 A list floats representing Matplotlib dates.
526
527 """
528 f1 = date2num(dstart)
529 f2 = date2num(dend)
530 step = delta.total_seconds() / SEC_PER_DAY
531
532 # calculate the difference between dend and dstart in times of delta
533 num = int(np.ceil((f2 - f1) / step))
534
535 # calculate end of the interval which will be generated
536 dinterval_end = dstart + num * delta
537
538 # ensure, that a half open interval will be generated [dstart, dend)
539 if dinterval_end >= dend:
540 # if the endpoint is greater than or equal to dend,
541 # just subtract one delta
542 dinterval_end -= delta
543 num -= 1
544
545 f2 = date2num(dinterval_end) # new float-endpoint
546 return np.linspace(f1, f2, num + 1)
547
548
549def _wrap_in_tex(text):

Callers 2

date_demo_rrule.pyFile · 0.90

Calls 1

date2numFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…