Public
Edited
Mar 20, 2023
Insert cell
Insert cell
data = FileAttachment("penguins.csv").csv({typed: true})
Insert cell
viewof bins = Inputs.text()
Insert cell
Plot.plot({
color: {legend: true},
width: width,
facet: {data: penguins,x: 'island'},
marks: [
Plot.frame(),
Plot.dot(penguins, {x: "flipper_length_mm",
y: "culmen_depth_mm",
r:2,
stroke: "species",
title: (d) => `First Line\nsecond line\n${d.sex}`}),
//Plot.dot(penguins.slice(),{x: 'flipper_length_mm',y: 'culmen_depth_mm',r:.2,stroke: 'black'}),
Plot.linearRegressionY(penguins, {x: "flipper_length_mm", y: "culmen_depth_mm", stroke: "steelblue", ci: 0.95})
]
})
Insert cell
Plot.plot({
width: width,
height: width/2,
marks: [
Plot.frame(),
Plot.dot(penguins,{x: 'culmen_length_mm', y: 'culmen_depth_mm', fill: 'species'})]
})
Insert cell
scatterPlot = function(data,x,y){
const output = Plot.plot({
marks: [
Plot.frame(),
Plot.dot(data,{x: x, y: y})]
})
return(output)
}
Insert cell
scatterPlot(penguins,'culmen_length_mm','body_mass_g')
Insert cell
penguins.csv
Type Table, then Shift-Enter. Ctrl-space for more options.

Insert cell
Type JavaScript, then Shift-Enter. Ctrl-space for more options. Arrow ↑/↓ to switch modes.

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