Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 99acf47

Browse files
committed
Remove date_ticker_factory
1 parent 17c018b commit 99acf47

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,
@@ -1779,50 +1778,6 @@ def _get_interval(self):
17791778
return self._interval
17801779

17811780

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

13521352

1353-
@pytest.mark.parametrize('span, expected_locator',
1354-
((0.02, mdates.MinuteLocator),
1355-
(1, mdates.HourLocator),
1356-
(19, mdates.DayLocator),
1357-
(40, mdates.WeekdayLocator),
1358-
(200, mdates.MonthLocator),
1359-
(2000, mdates.YearLocator)))
1360-
def test_date_ticker_factory(span, expected_locator):
1361-
with pytest.warns(_api.MatplotlibDeprecationWarning):
1362-
locator, _ = mdates.date_ticker_factory(span)
1363-
assert isinstance(locator, expected_locator)
1364-
1365-
13661353
def test_datetime_masked():
13671354
# make sure that all-masked data falls back to the viewlim
13681355
# set in convert.axisinfo....

0 commit comments

Comments
 (0)