Public
Edited
Aug 1, 2023
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
maples = d3.csv("https://portal.edirepository.org/nis/dataviewer?packageid=knb-lter-hbr.157.3&entityid=5c415a399b00430d35d13c31312f1e53", d3.autoType)
Insert cell
Insert cell
Insert cell
Insert cell
maples
Type Table, then Shift-Enter. Ctrl-space for more options.

Insert cell
Insert cell
Insert cell
Insert cell
maples2003 = maples.map(({
Year: year,
Watershed: watershed,
StemLength: stemLength,
LeafDryMass: leafMass,
StemDryMass: stemMass,
CorrectedLeafArea: leafArea
}) => ({ year, watershed, stemLength, leafMass, stemMass, leafArea }))
.filter(({year}) => year == 2003)
Insert cell
Insert cell
Insert cell
Insert cell
maples2003
X
leafArea
Y
Color
watershed
Size
Facet X
Facet Y
watershed
Mark
Auto
Type Chart, then Shift-Enter. Ctrl-space for more options.

Insert cell
Insert cell
Insert cell
Insert cell
Plot.plot({
marks: [
Plot.dot(maples2003, {
x: "stemLength",
y: "stemMass",
fill: "watershed",
opacity: 0.5,
tip: true,
}),
Plot.linearRegressionY(maples2003, {
x: "stemLength",
y: "stemMass",
stroke: "watershed",
})
],
})
Insert cell
Insert cell
Insert cell
Insert cell
import { PlotMatrix } with { maples2003 as data } from "@observablehq/autoplot-matrix"
Insert cell
maplesMatrix = PlotMatrix({data: maples2003})
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
maplesScaled= scale(maples2003)
Insert cell
maplesArray = maplesScaled.map(({stemLength, leafMass, stemMass, leafArea}) => [stemLength, leafMass, stemMass, leafArea ] )
Insert cell
ML = require("https://www.lactame.com/lib/ml/6.0.0/ml.min.js")
Insert cell
maplesClusters = ML.KMeans(maplesArray, 2)
Insert cell
maplesWithClustersSoundsLikeACereal = maplesScaled.map(({year, watershed, ...maple}, i) => ({...maple, cluster: maplesClusters.clusters[i], watershed: maples2003[i].watershed}))
Insert cell
maplesWithClustersSoundsLikeACereal
X
leafMass
Y
leafArea
Color
cluster
Size
Facet X
Facet Y
watershed
Mark
Auto
Type Chart, then Shift-Enter. Ctrl-space for more options.

Insert cell
maplesWithClustersSoundsLikeACereal
X
stemLength
Y
stemMass
Color
cluster
Size
Facet X
Facet Y
watershed
Mark
Auto
Type Chart, then Shift-Enter. Ctrl-space for more options.

Insert cell
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