Plot.plot({
marginLeft: 100,
label: null,
color: {
domain: ["Pathological MR", "Normal MR"],
range: ["lightblue", "blue"]
},
x: {
label: "Percent of MRIs",
axis: "top",
domain: [0, 100],
percent: false
},
y: {
ticks: [1, 3],
tickFormat: (i) => ["Pathological MR", "Normal MR"][(i - 1) / 2],
type: "linear"
},
marks: [
Plot.rectX(
csv,
Plot.stackX({
x: "percent_cognitive_impairment",
y: (d) => (d["MR_normal_or_not"] === "Pathological MR" ? 0.99 : 3.01),
stroke: "white",
fill: "lightblue",
interval: 1
})
),
Plot.areaX(
csv,
Plot.stackX({
x: "percent_cognitive_impairment",
y: (d) => (d["MR_normal_or_not"] === "Pathological MR" ? 0.99 : 3.01),
fill: "lightblue",
stroke: "white"
})
)
],
height: 200
})