matplotlib how to specify time locator's start-ticking timestamp?

前端 未结 2 1038
耶瑟儿~
耶瑟儿~ 2021-02-01 11:10

All I want is quite straight forward, I just want the locator ticks to start at a specified timestamp:
peudo code: locator.set_start_ticking_at( datetime_dummy )

2条回答
  •  轮回少年
    2021-02-01 11:52

    Instead of using the interval keyword parameter, use bysecond and byminute to specify exactly which seconds and minutes you with to mark. The bysecond and byminute parameters are used to construct a dateutil rrule. The rrule generates datetimes which match certain specified patterns (or, one might say, "rules").

    For example, bysecond=[20, 40] limits the datetimes to those whose seconds equal 20 or 40. Thus, below, the minor tick marks only appear for datetimes whose soconds equal 20 or 40.

    import numpy as np
    import matplotlib.pyplot as plt
    import matplotlib.dates as matdates
    
    N = 100
    
    fig, ax = plt.subplots()
    x = np.arange(N).astype('

提交回复
热议问题