The initial error comes from the _freedman_diaconis_bins function, which I fixed with a straightforward check on data type. However, once the code got through that hurdle, it runs into a more complicated blocker with an overflow error derived from matplotlib's handling of dates as integer. I get around the overflow issue with some manipulation of the object state, but some of the fix is admittedly imperfect. Nonetheless, this code alleviates the original problem seen with datetime64[ns] handling, see plot below for example code and plot:
import numpy as np
from seaborn import axisgrid as ag
dates = np.arange("2024-01-01", "2024-04-01", dtype="datetime64[D]").astype("datetime64[ns]")
random_dates = np.random.choice(dates, size=1000)
y = np.random.normal(size=1000)
plot = ag.jointplot(x=random_dates, y=y, kind="hex")
plot.fig.savefig("out.png")
The initial error comes from the
_freedman_diaconis_bins
function, which I fixed with a straightforward check on data type. However, once the code got through that hurdle, it runs into a more complicated blocker with an overflow error derived from matplotlib's handling of dates as integer. I get around the overflow issue with some manipulation of the object state, but some of the fix is admittedly imperfect. Nonetheless, this code alleviates the original problem seen withdatetime64[ns]
handling, see plot below for example code and plot: