Skip to content

Commit c6491af

Browse files
committed
Remove date_ticker_factory
1 parent 8e59326 commit c6491af

File tree

2 files changed

+0
-58
lines changed

2 files changed

+0
-58
lines changed

lib/matplotlib/dates.py

Lines changed: 0 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,6 @@
172172
import datetime
173173
import functools
174174
import logging
175-
import math
176175
import re
177176

178177
from dateutil.rrule import (rrule, MO, TU, WE, TH, FR, SA, SU, YEARLY,
@@ -1777,50 +1776,6 @@ def _get_interval(self):
17771776
return self._interval
17781777

17791778

1780-
@_api.deprecated("3.6", alternative="`AutoDateLocator` and `AutoDateFormatter`"
1781-
" or vendor the code")
1782-
def date_ticker_factory(span, tz=None, numticks=5):
1783-
"""
1784-
Create a date locator with *numticks* (approx) and a date formatter
1785-
for *span* in days. Return value is (locator, formatter).
1786-
"""
1787-
1788-
if span == 0:
1789-
span = 1 / HOURS_PER_DAY
1790-
1791-
mins = span * MINUTES_PER_DAY
1792-
hrs = span * HOURS_PER_DAY
1793-
days = span
1794-
wks = span / DAYS_PER_WEEK
1795-
months = span / DAYS_PER_MONTH # Approx
1796-
years = span / DAYS_PER_YEAR # Approx
1797-
1798-
if years > numticks:
1799-
locator = YearLocator(int(years / numticks), tz=tz) # define
1800-
fmt = '%Y'
1801-
elif months > numticks:
1802-
locator = MonthLocator(tz=tz)
1803-
fmt = '%b %Y'
1804-
elif wks > numticks:
1805-
locator = WeekdayLocator(tz=tz)
1806-
fmt = '%a, %b %d'
1807-
elif days > numticks:
1808-
locator = DayLocator(interval=math.ceil(days / numticks), tz=tz)
1809-
fmt = '%b %d'
1810-
elif hrs > numticks:
1811-
locator = HourLocator(interval=math.ceil(hrs / numticks), tz=tz)
1812-
fmt = '%H:%M\n%b %d'
1813-
elif mins > numticks:
1814-
locator = MinuteLocator(interval=math.ceil(mins / numticks), tz=tz)
1815-
fmt = '%H:%M:%S'
1816-
else:
1817-
locator = MinuteLocator(tz=tz)
1818-
fmt = '%H:%M:%S'
1819-
1820-
formatter = DateFormatter(fmt, tz=tz)
1821-
return locator, formatter
1822-
1823-
18241779
class DateConverter(units.ConversionInterface):
18251780
"""
18261781
Converter for `datetime.date` and `datetime.datetime` data, or for

lib/matplotlib/tests/test_dates.py

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1371,19 +1371,6 @@ def test_concise_formatter_call():
13711371
assert formatter.format_data_short(19002.0) == '2022-01-10 00:00:00'
13721372

13731373

1374-
@pytest.mark.parametrize('span, expected_locator',
1375-
((0.02, mdates.MinuteLocator),
1376-
(1, mdates.HourLocator),
1377-
(19, mdates.DayLocator),
1378-
(40, mdates.WeekdayLocator),
1379-
(200, mdates.MonthLocator),
1380-
(2000, mdates.YearLocator)))
1381-
def test_date_ticker_factory(span, expected_locator):
1382-
with pytest.warns(_api.MatplotlibDeprecationWarning):
1383-
locator, _ = mdates.date_ticker_factory(span)
1384-
assert isinstance(locator, expected_locator)
1385-
1386-
13871374
def test_datetime_masked():
13881375
# make sure that all-masked data falls back to the viewlim
13891376
# set in convert.axisinfo....

0 commit comments

Comments
 (0)