本文整理汇总了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()
示例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()
示例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
示例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
示例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