8000 dates: adjust view/datalim for longer plots · matplotlib/matplotlib@59f7f52 · GitHub
[go: up one dir, main page]

Skip to content

Commit 59f7f52

Browse fil 8000 es
committed
dates: adjust view/datalim for longer plots
1 parent 74d354d commit 59f7f52

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

lib/matplotlib/dates.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -953,7 +953,10 @@ def datalim_to_dt(self):
953953
if dmin > dmax:
954954
dmin, dmax = dmax, dmin
955955

956-
return num2date(dmin, self.tz, 1), num2date(dmax, self.tz, 1)
956+
mup = 20
957+
if abs(dmax - dmin) < 1000. / MUSECONDS_PER_DAY:
958+
mup = 1
959+
return num2date(dmin, self.tz, mup), num2date(dmax, self.tz, mup)
957960

958961
def viewlim_to_dt(self):
959962
"""
@@ -963,7 +966,11 @@ def viewlim_to_dt(self):
963966
if vmin > vmax:
964967
vmin, vmax = vmax, vmin
965968

966-
return num2date(vmin, self.tz, 1), num2date(vmax, self.tz, 1)
969+
mup = 20
970+
if abs(vmax - vmin) < 1000. / MUSECONDS_PER_DAY:
971+
mup = 1
972+
973+
return num2date(vmin, self.tz, mup), num2date(vmax, self.tz, mup)
967974

968975
def _get_unit(self):
969976
"""

0 commit comments

Comments
 (0)
0