I’m trying to plot a time-related histogram where the x-axis is times in a day, but I want the ticks to increase every 30 minutes instead of the crazy amount of ticks defaulted by Gadfly.
Any other plotting package solution are also welcomed, Gadfly seems to be unable to handle Time from DateTime.
Just for the record, the inbuilt DateTime axis handling seems broken for histograms in Plots as well (so you could do something like the above, but it won’t do it automatically).
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