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:
const { muze, getDataFromSearchQuery } = viz;
const data = getDataFromSearchQuery();
const ColumnField = { field: "weight_bin", as: "continuous" };
const RowField = "weight";
const ColorField = "sex";
muze
.canvas()
.columns([ColumnField])
.rows([RowField])
.layers([
{
mark: "bar",
encoding: {
color: ColorField,
},
config: {
transform: {
type: "stack",
},
},
},
])
.data(data)
.mount("#chart"); // mount your chart