Plotting a grouped bar chart in Gnuplot.jl

pinging @gcalderone

I am trying to create a grouped bar chart. Something like Clustered bar plot in gnuplot - Stack Overflow or Gnuplot documentation (bersch.net) but I am not getting anywhere.

I have so far

 @gp "reset"
    @gp :- "set key left"
    @gp :- "set style data histogram"
    @gp :- "set style histogram cluster"
    @gp :- "set style fill solid border rgb 'black"
    #@gp :- "set auto x"
    #@gp :- "set yrange [0:*]"
    @gp :- "using $(dda[:, 1]) title 'hello'" #lw 2 dt 1 lc rgb 'black'
    #@gp :- [22, 22, 22] dda[:, 2] "title 'hello'" #lw 2 dt 1 lc rgb 'black'
    @gp

where dda is

julia> dda
3×4 Adjoint{Float64,Array{Float64,2}}:
 0.444444  3.77778  7.382    20.7153
 0.466667  3.96667  7.74938  21.7494
 0.511111  4.34444  8.44978  23.7831

I was able to figure out a solution. There are a few factors at play. First, when using set style data histogram it only expects one column for the plotting command. Second, the natural x tic values start at 0 and increment by 1.

So we simply have to simply add each column 1 by 1.

 @gp "reset"
    @gp :- "set key left"
    @gp :- "set style data histogram"
    @gp :- "set style histogram cluster gap 1"
    @gp :- "set style fill solid border rgb 'black"
    @gp :- "set auto x"
    #@gp :- "set yrange [0:*]"
    @gp :- dda[:, 1] "title '30 days'" #lw 2 dt 1 lc rgb 'black'
    @gp :- dda[:, 2] "title '45 days'" #lw 2 dt 1 lc rgb 'black'
    @gp :- dda[:, 3] "title '90 days'" #lw 2 dt 1 lc rgb 'black'
    @gp :- dda[:, 4] "title '150 days'" #lw 2 dt 1 lc rgb 'black'
    @gp

For the x labels, if using gnuplot script, one can say plot for [COL=2:4:2] 'file.dat' using COL:xticlabels(1) where the x-axis label is then calculated from the first column of the data file. But given that we are in Julia code, I am not sure how to write the equivalent. Instead, a solution is to replace the xtic values manually.

 @gp :- "set xtics $xticvals" 

where xticvals = ("label 1" 0, "label 2", 1"...)