Skip to content

Commit 36dd933

Browse files
committed
avoid floating numbers as intervals
1 parent 2e8184b commit 36dd933

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

lib/matplotlib/dates.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -1241,7 +1241,7 @@ def __init__(self, tz=None, minticks=5, maxticks=None,
12411241
MINUTELY: len(rcParams['date.autoformatter.minute']),
12421242
SECONDLY: len(rcParams['date.autoformatter.second']),
12431243
MICROSECONDLY: len(rcParams['date.autoformatter.microsecond'])}
1244-
1244+
print(self.eachtick_len)
12451245
if maxticks is not None:
12461246
try:
12471247
self.maxticks.update(maxticks)
@@ -1340,7 +1340,7 @@ def get_locator(self, dmin, dmax):
13401340
# more than maxticks tick positions. Also, set up some ranges
13411341
# (bymonth, etc.) as appropriate to be passed to rrulewrapper.
13421342

1343-
# a ratio of 12 default font sized date chars per inch is 'estimated'
1343+
# a ratio of 10 default font sized date chars per inch is 'estimated'
13441344
maxwid = rcParams["figure.figsize"][0] * 12
13451345
for i, (freq, num) in enumerate(zip(self._freqs, nums)):
13461346

@@ -1356,7 +1356,7 @@ def get_locator(self, dmin, dmax):
13561356
# ticks
13571357
for interval in self.intervald[freq]:
13581358
if (num <= interval * (self.maxticks[freq] - 1)):
1359-
if (num/interval * self.eachtick_len[freq] <= maxwid):
1359+
if ((num//interval) * self.eachtick_len[freq] <= maxwid):
13601360
break
13611361
else:
13621362
# We went through the whole loop without breaking, default to
@@ -1369,7 +1369,7 @@ def get_locator(self, dmin, dmax):
13691369

13701370
# Set some parameters as appropriate
13711371
self._freq = freq
1372-
1372+
print(self._byranges[i])
13731373
if self._byranges[i] and self.interval_multiples:
13741374
byranges[i] = self._byranges[i][::interval]
13751375
interval = 1

0 commit comments

Comments
 (0)