Public
Edited
Jul 26, 2023
16 forks
14 stars
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
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
crabs
Insert cell
Insert cell
Insert cell
Object.keys(crabs[0])
Insert cell
Insert cell
crabsJS = crabs.map(d => ({lat: d.Latitude,
site: d["Site "],
sizeMm: d.carapace_width,
airTempC: d.MATA,
waterTempC: d.MATW}))
Insert cell
Insert cell
Insert cell
Insert cell
crabs
X
carapace_width
Y
Color
#c83dac
Size
Facet X
Facet Y
Site
Mark
Auto
Type Chart, then Shift-Enter. Ctrl-space for more options.

Insert cell
Plot.plot({
marks: [
Plot.rectY(
crabs,
Plot.binX(
{ y: "count" },
{fy: "Site ", x: "carapace_width", fill: "red", tip: true }
)
),
Plot.frame({strokeOpacity: 0.1})
]
})
Insert cell
Insert cell
Plot.plot({
marks: [
Plot.dot(crabsJS, {y: "lat", x: "sizeMm", fill: "site", opacity: 0.5, r: 5}),
Plot.frame({stroke: "#ccc"})
],
height: 500,
inset: 20,
y: {ticks: 5},
color: {legend: true}
})
Insert cell
Plot.plot({
marks: [
Plot.dot(crabsJS, {y: "sizeMm", x: "waterTempC", fill: "gray", opacity: 0.5, r: 5}),
Plot.frame({stroke: "#ccc"})
],
height: 500,
inset: 20,
y: {ticks: 5},
grid: 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
crabsLM = new ML.SimpleLinearRegression(crabsJS.map(d => d.lat), crabsJS.map(d => d.sizeMm))
Insert cell
crabsLM.slope
Insert cell
crabsLM.intercept
Insert cell
crabsLM.predict(36)
Insert cell
Insert cell
Insert cell
Plot.plot({
marks: [
Plot.dot(crabsJS, {x: "lat", y: "sizeMm", fill: "steelblue", opacity: 0.6, r: 4}),
Plot.dot(crabsJS, Plot.groupX({ y: "mean" }, { x: "lat", y: "sizeMm", tip: true, fill: "orange", symbol: "square", r: 4})),
Plot.linearRegressionY(crabsJS, {x: "lat", y: "sizeMm"}),
Plot.frame()
],
x: {label: "Latitude (degrees)", domain: [28, 44]},
y: {label: "Carapace size (millimeters)", domain: [5, 25], ticks: 5, grid: true}
})
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