has2k1 / mizani

A scales package for python
https://mizani.readthedocs.io
BSD 3-Clause "New" or "Revised" License
49 stars 14 forks source link

Improve date_breaks #6

Closed has2k1 closed 6 years ago

has2k1 commented 6 years ago

has2k1/plotnine/issues/87

Change self.intervald[YEARLY] factors. But this would be a partial solution, MPL yearly datelocator needs to get smarter and choose ticks at the decades.

import datetime
from mizani.breaks import date_breaks

limits = [datetime.datetime(1965, 1, 1),
          datetime.datetime(2017, 1, 1)]
breaks = date_breaks()
breaks(limits)
Out[1]: [datetime.datetime(2013, 1, 1, 0, 0, tzinfo=<matplotlib.dates._UTC object at 0x7fa4eccd7cf8>)]
has2k1 commented 6 years ago

Related: matplotlib/matplotlib/issues/9838.

has2k1 commented 6 years ago

The upstream bug was fixed. Will be functional in MPL v2.2.