Public
Edited
Jul 31, 2023
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
HTL-MAR-FiddlerCrabBodySize.csv
Type Table, then Shift-Enter. Ctrl-space for more options.

Insert cell
Insert cell
Insert cell
crabs
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
crabsJS
X
airTempC
Y
sizeMm
Color
#32529b
Size
Facet X
Facet Y
Mark
Auto
Type Chart, then Shift-Enter. Ctrl-space for more options.

Insert cell
viewof pickSize = Inputs.range([0, 100], {label: "Amount", step: 1})
Insert cell
Plot.plot({
x: {},
y: { label: "Carapace Size (millimeters)" },
marks: [
Plot.dot(crabsJS, {
x: "airTempC",
y: "sizeMm",
stroke: "#32529b",
fill: d => d.site,
tip: true,
r: pickSize,
opacity: 0.5,
})
]
})
Insert cell
Insert cell
Insert cell
Plot.plot({
marks: [
Plot.dot(crabsJS, {x: "lat", y: "sizeMm", tip: true})
]
})
Insert cell
Insert cell
Insert cell
ML = require("https://www.lactame.com/lib/ml/6.0.0/ml.min.js")
Insert cell
Insert cell
// linear model
// simple linear regression expects an array of values for x and an array of values for the corresponding ys
crabsLM = new ML.SimpleLinearRegression(
crabsJS.map(({lat}) => lat),
crabsJS.map(({sizeMm}) => sizeMm),
)
Insert cell
Insert cell
Insert cell
crabsJS
X
lat
Y
sizeMm
Color
Size
Facet X
Facet Y
Mark
dot
Type Chart, then Shift-Enter. Ctrl-space for more options.

Insert cell
Plot.plot({
marks: [
Plot.dot(crabsJS, { x: "lat", y: "sizeMm", tip: true, opacity: 0.5, fill: "green" }),
Plot.linearRegressionY(crabsJS, { x : "lat", y: "sizeMm"}),
Plot.frame()
],
x: {label: "Latitude"},
y: {label: "Carapace size (mm)"},
})
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell

One platform to build and deploy the best data apps

Experiment and prototype by building visualizations in live JavaScript notebooks. Collaborate with your team and decide which concepts to build out.
Use Observable Framework to build data apps locally. Use data loaders to build in any language or library, including Python, SQL, and R.
Seamlessly deploy to Observable. Test before you ship, use automatic deploy-on-commit, and ensure your projects are always up-to-date.
Learn more