File tree Expand file tree Collapse file tree 2 files changed +15
-0
lines changed Expand file tree Collapse file tree 2 files changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -796,6 +796,10 @@ def format_ticks(self, values):
796
796
for level in range (5 , - 1 , - 1 ):
797
797
if len (np .unique (tickdate [:, level ])) > 1 :
798
798
break
799
+ elif level == 0 :
800
+ # all tickdate are the same, so only micros might be different
801
+ # set to the most precise (6: microseconds doesn't exist...)
802
+ level = 5
799
803
800
804
# level is the basic level we will label at.
801
805
# now loop through and decide the actual ticklabels
Original file line number Diff line number Diff line change @@ -449,6 +449,17 @@ def _create_auto_date_locator(date1, date2):
449
449
assert list (map (str , mdates .num2date (locator ()))) == expected
450
450
451
451
452
+ def test_concise_formatter_subsecond ():
453
+ locator = mdates .AutoDateLocator (interval_multiples = True )
454
+ formatter = mdates .ConciseDateFormatter (locator )
455
+ year_1996 = 9861.0
456
+ strings = formatter .format_ticks ([
457
+ year_1996 ,
458
+ year_1996 + 500 / mdates .MUSECONDS_PER_DAY ,
459
+ year_1996 + 900 / mdates .MUSECONDS_PER_DAY ])
460
+ assert strings == ['00:00' , '00.0005' , '00.0009' ]
461
+
462
+
452
463
def test_concise_formatter ():
453
464
def _create_auto_date_locator (date1 , date2 ):
454
465
fig , ax = plt .subplots ()
You can’t perform that action at this time.
0 commit comments