Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions doc/api/next_api_changes/deprecations/23081-OG.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
``date_ticker_factory`` deprecated
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

The ``date_ticker_factory`` method in the `matplotlib.dates` module is
deprecated. Instead use `~.AutoDateLocator` and `~.AutoDateFormatter` for a
more flexible and scalable locator and formatter.

If you need the exact ``date_ticker_factory`` behavior, please copy the code.
2 changes: 2 additions & 0 deletions lib/matplotlib/dates.py
Original file line number Diff line number Diff line change
Expand Up @@ -1782,6 +1782,8 @@ def num2epoch(d):
return np.asarray(d) * SEC_PER_DAY - dt


@_api.deprecated("3.6", alternative="`AutoDateLocator` and `AutoDateFormatter`"
" or vendor the code")
def date_ticker_factory(span, tz=None, numticks=5):
"""
Create a date locator with *numticks* (approx) and a date formatter
Expand Down
5 changes: 3 additions & 2 deletions lib/matplotlib/tests/test_dates.py
Original file line number Diff line number Diff line change
Expand Up @@ -1319,8 +1319,9 @@ def test_concise_formatter_call():
(200, mdates.MonthLocator),
(2000, mdates.YearLocator)))
def test_date_ticker_factory(span, expected_locator):
locator, _ = mdates.date_ticker_factory(span)
assert isinstance(locator, expected_locator)
with pytest.warns(_api.MatplotlibDeprecationWarning):
locator, _ = mdates.date_ticker_factory(span)
assert isinstance(locator, expected_locator)


def test_usetex_newline():
Expand Down