File tree Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -1828,14 +1828,16 @@ def cycle_changer(
1828
1828
# Step size for grouped bar plots
1829
1829
# WARNING: This will fail for non-numeric non-datetime64 singleton
1830
1830
# datatypes but this is good enough for vast majority of most cases.
1831
- x_step = np .atleast_1d (_to_ndarray (x ))
1832
- if len (x_step ) >= 2 :
1833
- x_step = x_step [1 :] - x_step [:- 1 ]
1831
+ x_test = np .atleast_1d (_to_ndarray (x ))
1832
+ if len (x_test ) >= 2 :
1833
+ x_step = x_test [1 :] - x_test [:- 1 ]
1834
1834
x_step = np .concatenate ((x_step , x_step [- 1 :]))
1835
- elif x_step .dtype == np .datetime64 :
1835
+ elif x_test .dtype == np .datetime64 :
1836
1836
x_step = np .timedelta64 (1 , 'D' )
1837
1837
else :
1838
- x_step = 0.5
1838
+ x_step = np .array (0.5 )
1839
+ if np .issubdtype (x_test .dtype , np .datetime64 ):
1840
+ x_step = x_step .astype ('timedelta64[ns]' ) # avoid int timedelta truncation
1839
1841
1840
1842
# Get x coordinates for bar plot
1841
1843
x_col , y_first = x , ys [0 ] # samples
You can’t perform that action at this time.
0 commit comments