当前位置: 首页>>代码示例>>Python>>正文


Python dates.rrulewrapper方法代码示例

本文整理汇总了Python中matplotlib.dates.rrulewrapper方法的典型用法代码示例。如果您正苦于以下问题:Python dates.rrulewrapper方法的具体用法?Python dates.rrulewrapper怎么用?Python dates.rrulewrapper使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在matplotlib.dates的用法示例。


在下文中一共展示了dates.rrulewrapper方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_DateFormatter

# 需要导入模块: from matplotlib import dates [as 别名]
# 或者: from matplotlib.dates import rrulewrapper [as 别名]
def test_DateFormatter():
    import matplotlib.testing.jpl_units as units
    units.register()

    # Lets make sure that DateFormatter will allow us to have tick marks
    # at intervals of fractional seconds.

    t0 = datetime.datetime(2001, 1, 1, 0, 0, 0)
    tf = datetime.datetime(2001, 1, 1, 0, 0, 1)

    fig = plt.figure()
    ax = plt.subplot(111)
    ax.set_autoscale_on(True)
    ax.plot([t0, tf], [0.0, 1.0], marker='o')

    # rrule = mpldates.rrulewrapper( dateutil.rrule.YEARLY, interval=500 )
    # locator = mpldates.RRuleLocator( rrule )
    # ax.xaxis.set_major_locator( locator )
    # ax.xaxis.set_major_formatter( mpldates.AutoDateFormatter(locator) )

    ax.autoscale_view()
    fig.autofmt_xdate() 
开发者ID:miloharper,项目名称:neural-network-animation,代码行数:24,代码来源:test_dates.py

示例2: test_RRuleLocator

# 需要导入模块: from matplotlib import dates [as 别名]
# 或者: from matplotlib.dates import rrulewrapper [as 别名]
def test_RRuleLocator():
    import matplotlib.testing.jpl_units as units
    units.register()

    # This will cause the RRuleLocator to go out of bounds when it tries
    # to add padding to the limits, so we make sure it caps at the correct
    # boundary values.
    t0 = datetime.datetime(1000, 1, 1)
    tf = datetime.datetime(6000, 1, 1)

    fig = plt.figure()
    ax = plt.subplot(111)
    ax.set_autoscale_on(True)
    ax.plot([t0, tf], [0.0, 1.0], marker='o')

    rrule = mdates.rrulewrapper(dateutil.rrule.YEARLY, interval=500)
    locator = mdates.RRuleLocator(rrule)
    ax.xaxis.set_major_locator(locator)
    ax.xaxis.set_major_formatter(mdates.AutoDateFormatter(locator))

    ax.autoscale_view()
    fig.autofmt_xdate() 
开发者ID:miloharper,项目名称:neural-network-animation,代码行数:24,代码来源:test_dates.py

示例3: _test_rrulewrapper

# 需要导入模块: from matplotlib import dates [as 别名]
# 或者: from matplotlib.dates import rrulewrapper [as 别名]
def _test_rrulewrapper(attach_tz, get_tz):
    SYD = get_tz('Australia/Sydney')

    dtstart = attach_tz(datetime.datetime(2017, 4, 1, 0), SYD)
    dtend = attach_tz(datetime.datetime(2017, 4, 4, 0), SYD)

    rule = mdates.rrulewrapper(freq=dateutil.rrule.DAILY, dtstart=dtstart)

    act = rule.between(dtstart, dtend)
    exp = [datetime.datetime(2017, 4, 1, 13, tzinfo=dateutil.tz.tzutc()),
           datetime.datetime(2017, 4, 2, 14, tzinfo=dateutil.tz.tzutc())]

    assert act == exp 
开发者ID:holzschu,项目名称:python3_ios,代码行数:15,代码来源:test_dates.py

示例4: test_rrulewrapper

# 需要导入模块: from matplotlib import dates [as 别名]
# 或者: from matplotlib.dates import rrulewrapper [as 别名]
def test_rrulewrapper():
    r = rrulewrapper(2)
    try:
        pickle.loads(pickle.dumps(r))
    except RecursionError:
        print('rrulewrapper pickling test failed')
        raise 
开发者ID:holzschu,项目名称:python3_ios,代码行数:9,代码来源:test_pickle.py

示例5: test_rrulewrapper

# 需要导入模块: from matplotlib import dates [as 别名]
# 或者: from matplotlib.dates import rrulewrapper [as 别名]
def test_rrulewrapper(attach_tz, get_tz):
    SYD = get_tz('Australia/Sydney')

    dtstart = attach_tz(datetime.datetime(2017, 4, 1, 0), SYD)
    dtend = attach_tz(datetime.datetime(2017, 4, 4, 0), SYD)

    rule = mdates.rrulewrapper(freq=dateutil.rrule.DAILY, dtstart=dtstart)

    act = rule.between(dtstart, dtend)
    exp = [datetime.datetime(2017, 4, 1, 13, tzinfo=dateutil.tz.tzutc()),
           datetime.datetime(2017, 4, 2, 14, tzinfo=dateutil.tz.tzutc())]

    assert act == exp 
开发者ID:alvarobartt,项目名称:twitter-stock-recommendation,代码行数:15,代码来源:test_dates.py


注:本文中的matplotlib.dates.rrulewrapper方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。