default_color = d3.schemeCategory10[0]
plt_color = color_var || default_color
all_vars = cont_vars.concat(disc_vars)
channels = Object.fromEntries(all_vars.map(k => [k[1], k[1]]))
viewof scatter = Plot.plot({
style: { fontFamily: "var(--sans-serif)" },
inset: 8,
grid: true,
x: { tickFormat: "" },
color: { legend: true },
marks: [
Plot.dot(d, {
x: x_var,
y: y_var,
stroke: plt_color,
tip: true,
channels: channels
}),
]
})
viewof x_hist = Plot.plot({
style: { fontFamily: "var(--sans-serif)" },
width: 640/2,
x: { tickFormat: "" },
y: { grid: true },
marks: [
Plot.rectY(d, Plot.binX({y: "count"}, {x: x_var, fill: plt_color})),
Plot.ruleY([0])
]
})
viewof y_hist = Plot.plot({
style: { fontFamily: "var(--sans-serif)" },
width: 640/2,
y: { grid: true },
marks: [
Plot.rectY(d, Plot.binX({y: "count"}, {x: y_var, fill: plt_color})),
Plot.ruleY([0])
]
})
html`<div style="display: flex; flex-wrap: wrap; align-items: flex-end;">
<div style="flex-basis: 25%"> ${viewof y_hist} </div>
<div style="flex-basis: 50%"> ${viewof scatter} </div>
<div style="flex-basis: 25%"> ${viewof x_hist} </div>
</div>`