Published
Edited
Apr 6, 2021
2 stars
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
base.markBar().render()
Insert cell
Insert cell
base = vl
.mark()
.encode(
vl
.x()
.fieldQ("body_mass_g")
.bin({ step: 100 })
.title("Body Mass(g)")
.axis({
labelExpr: "[datum.value % 500===0 ? datum.value : '']"
}),
vl
.y()
.count()
.title("Frequency"),
vl
.color()
.fieldN("species")
.title("Species")
.scale(colorScale)
)
.data(penguins.filter(d => d.body_mass_g !== "NA"))
.config({ axisX: { tickCount: 3 } })
.title("Penguin Body Mass")
Insert cell
colorScale = ({ range: ["#febb84", "#c47ff4", "#88bcba"] })
Insert cell
import { penguins } from "@enjalot/palmer-penguins"
Insert cell
import { vl } from "@vega/vega-lite-api"
Insert cell
md`### Debugging the holes in the areas

Is it missing data? There are a couple "NA"s, but removing them didn't fix it :(`
Insert cell
allData = navio(penguins, { width: 600, attribWidth: 26 })
Insert cell
import { navio} from "@john-guerra/navio"
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more