When plotting a “stacked histogram”, I would like the “stack order” to be the same as the legend order - Fair
(first / bottom) and Ideal
(last / top) - so that the colors are in order from light to dark. Like in this example.
Any idea how to do that? My code so far:
using CSV, DataFrames, Gadfly
download("https://raw.githubusercontent.com/mwaskom/seaborn-data/master/diamonds.csv", "diamonds.csv")
diamonds = DataFrame(CSV.File("diamonds.csv"))
palette = ["#9D95C2", "#B4ADCF", "#C9C4DB", "#DFDCE9", "#F5F3F4"]
plot(
diamonds,
x = :price,
color = :cut,
Geom.histogram(bincount=50),
Scale.x_log10,
Scale.color_discrete_manual(palette..., order = [1, 2, 4, 3, 5]),
Theme(
background_color = "white",
bar_highlight = color("black")
),
)