Closed
Description
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
import datetime
import matplotlib.pyplot as plt
x = [datetime.datetime(1966, 1, 1),
datetime.datetime(2017, 1, 1)]
ticks = [datetime.datetime(i, 1, 1)
for i in range(1970, 2020, 10)]
y = np.arange(len(x))
fig, ax = plt.subplots()
ax.plot_date(x, y)
# ax.set_xticks(ticks) # preferred ticks
Metadata
Metadata
Assignees
Labels
No labels