Gadfly question: How to make Geom.bar slimmer, give alternating colors to bars and bars display their values

Here’s my quick attempt at this:

plot(df, y=:country, x=:percent, Geom.bar(orientation=:horizontal),
    Geom.label(position=:right), label=string.(df.percent),
    Guide.ylabel(""), color=isodd.(axes(df,1)), 
    Theme(bar_spacing=1mm, key_position=:none))

benibilme

But note there is a small bug in the code when Geom.bar is used with color (Bar spacing shifting stacked plot off center · Issue #1542 · GiovineItalia/Gadfly.jl · GitHub), which I should find time to fix now.

2 Likes