Skip to content

Commit a6dc25d

Browse files
committed
BUG: Take the absolute difference between times when determining the correct tick interval
1 parent 0575dc5 commit a6dc25d

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

lib/matplotlib/dates.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -898,6 +898,10 @@ def get_locator(self, dmin, dmax):
898898
'Pick the best locator based on a distance.'
899899
delta = relativedelta(dmax, dmin)
900900

901+
# take absolute difference
902+
if dmin > dmax:
903+
delta = -delta
904+
901905
numYears = (delta.years * 1.0)
902906
numMonths = (numYears * 12.0) + delta.months
903907
numDays = (numMonths * 31.0) + delta.days

0 commit comments

Comments
 (0)