Plot.rectY(filtered,
Plot.binX(
{y: "count"},
{x: "body_mass", fill: "species", thresholds: 20}
))
.plot({
facet: {
data: filtered,
x: "sex",
y: "species",
marginRight: 80
},
marks: [
Plot.frame(),
]
}
)
Layout
This example uses page-layout: full
to have its contents occupy the entire width of the page:
---
title: "Layout"
format:
html:
page-layout: full
---
Enclose the inputs in a sidebar panel and the outputs in a tabset panel (click the “Code” button at top right to see the full source code):
Read and filter the data based on the user’s inputs:
= FileAttachment("palmer-penguins.csv").csv({typed: true})
data
= data.filter(function(penguin) {
filtered return bill_length_min < penguin.bill_length &&
.includes(penguin.island);
islands })