File tree 1 file changed +10
-6
lines changed
1 file changed +10
-6
lines changed Original file line number Diff line number Diff line change @@ -284,12 +284,16 @@ def labelLines(
284
284
converter = ax .xaxis .get_converter ()
285
285
time_classes = (_SwitchableDateConverter , DateConverter , ConciseDateConverter )
286
286
if isinstance (converter , time_classes ):
287
- xvals = [
288
- x # type: ignore
289
- if isinstance (x , (np .datetime64 , datetime ))
290
- else num2date (x ).replace (tzinfo = ax .xaxis .get_units ())
291
- for x in xvals # type: ignore
292
- ]
287
+ xvals_dates = []
288
+ for x in xvals : # type: ignore
289
+ if isinstance (x , datetime ):
290
+ x_datetime = x
291
+ elif isinstance (x , np .datetime64 ):
292
+ x_datetime = x .astype (datetime )
293
+ else :
294
+ x_datetime = num2date (x )
295
+ xvals_dates .append (x_datetime .replace (tzinfo = ax .xaxis .get_units ()))
296
+ xvals = xvals_dates # type: ignore
293
297
294
298
txts = []
295
299
try :
You can’t perform that action at this time.
0 commit comments