当前位置: 首页>>编程示例 >>用法及示例精选 >>正文


Python matplotlib YearLocator用法及代码示例

本文简要介绍 python 语言中 matplotlib.dates.YearLocator 的用法。

用法

class matplotlib.dates.YearLocator(base=1, month=1, day=1, tz=None)

基础:RRuleLocator

在每年的给定日期打勾,这是基数的倍数。

例子:

# Tick every year on Jan 1st
locator = YearLocator()

# Tick every 5 years on July 4th
locator = YearLocator(5, month=7, day=4)
参数
base 整数,默认值:1

标记每 base 年标记一次。

month 整数,默认值:1

放置刻度的月份,从 1 开始。默认为一月。

day 整数,默认值:1

放置刻度线的日期。

tz str 或 tzinfo ,默认值:rcParams["timezone"](默认值:'UTC')

勾选时区。如果是字符串,则将 tz 传递给 dateutil.tz

相关用法


注:本文由纯净天空筛选整理自skytowner.com大神的英文原创作品 matplotlib.dates.YearLocator。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。