plt = {
var plt;
if (bin_input[0] == 'manual choice'){
plt = Plot.plot({
width: 1600, // or a dynamic value based on `width` variable
height: 900,
caption: 'Histogram of the age distribution on the Titanic',
facet: {
data: titanic,
x: "Sex"
},
marks: [
Plot.rectY(titanic, Plot.binX({y: "count"}, {x: "Age", thresholds: bin_input[1], fill: "Sex"})),
Plot.ruleY([0])
]
})
}else{
plt = Plot.plot({
caption: 'Histogram of the age distribution on the Titanic',
facet: {
data: titanic,
x: "Sex"
},
marks: [
Plot.rectY(titanic, Plot.binX({y: "count"}, {x: "Age", thresholds: bin_input[0], fill: "Sex"})),
Plot.ruleY([0])
]
})
}
return plt;
}