Public
Edited
Jul 12, 2023
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
crabs = FileAttachment("HTL-MAR-FiddlerCrabBodySize.csv").csv()
Insert cell
Insert cell
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
Object.keys(crabsJS[0])
Insert cell
Insert cell
Insert cell
Insert cell
crabsJS
X
sizeMm
Y
Color
#ff57f6
Size
Facet X
Facet Y
Mark
Auto
Type Chart, then Shift-Enter. Ctrl-space for more options.

Insert cell
Plot.plot({
x: { label: "Carapace Size (mm)" },
marks: [
Plot.rectY(
crabsJS,
Plot.binX({ y: "count" }, { x: "sizeMm", fill: "#ff57f6", tip: true })
),
Plot.ruleY([0])
]
})
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
crabsLM = new ML.SimpleLinearRegression(
crabsJS.map((d) => d.lat),
crabsJS.map((d) => d.sizeMm)
)
Insert cell
Insert cell
crabsJS.map((d) => d.lat) // gives an array of lattitudes as an example, ML needs an array for X and Y
Insert cell
Insert cell
Insert cell
crabsJS
X
lat
Y
mean
sizeMm
Color
Size
Facet X
Facet Y
Mark
Auto
Type Chart, then Shift-Enter. Ctrl-space for more options.

Insert cell
Plot.plot({
marks: [
Plot.dot(crabsJS, {x: "lat",y: "sizeMm", tip: true}),
Plot.linearRegressionY(crabsJS, {x: "lat", y: "sizeMm"}),
Plot.frame()
],
x: {label: "Latitude"},
y: {label: "Carapace size (mm)"}
})
Insert cell
Insert cell
Insert cell
screenShot20230711At114728Am = FileAttachment("Screen Shot 2023-07-11 at 11.47.28 AM.png").image()
Insert cell
Insert cell
Insert cell
screenShot20230711At115145Am = FileAttachment("Screen Shot 2023-07-11 at 11.51.45 AM.png").image()
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