Groupby date shows empty plot

I am trying to create a plot from an xarray dataset (ds) with the data grouped by dates using hvplot. ds contains a coordinate ‘time’ of datetime64 and when trying to plot the data like this:
plot = ds.hvplot(x='time', groupby='')
the plot is always empty, it seems like it looks for data that matches the exact datetime (at 0:00:00 of the respective date), although I want to plot all data corresponding to this date.
When grouping like this:
plot = ds.hvplot(x='time', groupby=['time.year', 'time.month', ''])
it works, however if I do not have contiguous data, it is a pain to adjust the sliders to get a combination where there actually exists data.
I think there has to be a better solution, however I could not find anything.
I would appreciate any help. Thanks in advance!

I do this:

df.assign(date=df.index.strftime('%Y-%m-%d')) \

The idea is to temporarily add a new string column based on the date of the DatetimeIndex that can be used for ‘groupby’. It looks quit nice and you can scrub through the days effortlessly.


Thanks for the hint, this is basically what I was looking for. It is almost the same when working with xarray. You can assign an extra coordinate date and group by this coordinate. E.g,

ds.assign_coords(date=ds.time.dt.strftime('%Y-%m-%d')) \
   .hvplot.line(x='time', groupby='date', height=500)
1 Like