Public
Edited
Aug 4, 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
import {aq, op} from "@uwdata/arquero"
Insert cell
maplesTable = aq.from(maples)
Insert cell
maples2003 = maples
.filter(d => d.Year === 2003)
.map(d => ({year: d.Year,
watershed: d.Watershed,
stemLength: d.StemLength,
leafMass: d.LeafDryMass,
stemMass: d.StemDryMass,
leafArea: d.CorrectedLeafArea
}))
Insert cell
Insert cell
Insert cell
Insert cell
maples2003
X
leafArea
Y
Color
#ffc850
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
Plot.plot({
marks: [
Plot.dot(maples2003, {x: "stemLength", y: "stemMass", fill: "watershed", opacity: 0.6, r: 5, tip: true}),
Plot.linearRegressionY(maples2003, {x: "stemLength", y: "stemMass", stroke: "watershed"})
]
})
Insert cell
Insert cell
Insert cell
Insert cell
import {PlotMatrix} with {data} from "@observablehq/autoplot-matrix"
Insert cell
data = maples2003
Insert cell
PlotMatrix(data)
Insert cell
Insert cell
Insert cell
Insert cell
import {scale} from "@chrispahm/hierarchical-clustering"
Insert cell
maplesScale = scale(maples2003)
Insert cell
Insert cell
maplesArray = maplesScale.map((d) => [d.stemLength, d.leafMass, d.stemMass, d.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
maplesKmeans = maples2003.map((d, i) => ({...d, clusterNo: maplesClusters.clusters[i]}))
Insert cell
myChart = Plot.plot({ // Remember to name if you want to use embeds!
marks: [
Plot.text(maplesKmeans, {
x: "stemLength",
y: "stemMass",
text: "clusterNo",
fontSize: "15px",
fontWeight: 500,
fill: "watershed",
tip: true
})
],
color: { legend: true }
})
Insert cell
Insert cell
Insert cell
Insert cell
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