Skip to main content

Stacked Histogram

Displays the frequency distribution of multiple variables within the same bins. This allows for the comparison of the distributions of multiple variables simultaneously. It is useful for understanding the overlap and differences between the distributions of different groups or categories.

Chart:


Code:

  muze
.canvas()
.columns([{ field: "weight_bin", as: "continuous" }])
.rows(["weight"])
.layers([
{
mark: "bar",
encoding: {
color: "sex",
},
config: {
transform: {
type: "stack",
},
},
},
])