Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

YearLocator should prefer ticks at the turn of the decade #9838

Closed
Milestone
@has2k1

Description

@has2k1

Bug summary

YearLocator is agnostic about decades. Ticks at the decades are nicer, so when choosing a starting value in some cases it should prefer to start a the turn of the decade or even mid decade. i.e 1970 instead of 1968, 1965 instead of 1964. This "smart" behaviour should apply when the intervals are factors of 5 and 10.

Code for reproduction

importdatetimeimportmatplotlib.pyplotaspltx= [datetime.datetime(1966,1,1),datetime.datetime(2017,1,1)]ticks= [datetime.datetime(i,1,1)foriinrange(1970,2020,10)]y=np.arange(len(x))fig,ax=plt.subplots()ax.plot_date(x,y)# ax.set_xticks(ticks)  # preferred ticks

Actual outcome
bad-date-ticks

Better outcome
good-date-ticks

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp