Here is the VegaLite.jl way:
using VegaLite, DataFrames, Dates
n = 1000
df = DataFrame(time = rand(DateTime(2018,1,1):Hour(1):DateTime(2019,1,1), n))
df |> @vlplot(:bar, x="yearmonthdate(time):o", y="count()")
Note how the only difference to the previous example is that I now use the yearmonthdate
time unit instead of the hours
time unit. You can see all time units that are supported by vega-lite here.
You’d probably want to adjust the width of the bars in this example, otherwise the plot gets a bit wide