Public
Edited
Apr 2, 2023
Insert cell
Insert cell
Insert cell
Insert cell
viewof bins = Inputs.range([3, 20], {step: 1, label: "Bins"})
Insert cell
Plot.plot({
marks: [
Plot.ruleY([0]),
Plot.rectY(data, Plot.binX({y: "count"}, {x: "Distance", thresholds: bins, fill: "#ff2800"})) // forza ferrari fill ha
]
})
Insert cell
Insert cell
Insert cell
Plot.plot({
x: {tickFormat: "d"},
marks: [
//Plot.dot(data, {x: "Year", y: "Distance"}),
Plot.line(data, {x: "Year", y: "Distance",
title: (d) => // tooltip, see imports at bottom
`${d.Car} #${d["Car #"]} \n Year: ${d.Year} \n Team: ${d.Team} \n Distance: ${d.Distance} mi.`
})
]
})
Insert cell
Insert cell
viewof regression_start_year = Inputs.range([1966, 2015], {value: 2004, step: 1, label: "Starting year:"})
Insert cell
regressionPlot = Plot.plot({
x: {tickFormat: "d"},
y: {label: "Distance (mi.)"},
marks: [
//Plot.dot(data, {x: "Year", y: "Distance"}),
Plot.line(lmdata, {x: "Year", y: "Distance"}),
Plot.linearRegressionY(lmdata, {x: "Year", y: "Distance", stroke: "steelblue", ci: 0.95})
]
})
Insert cell
Insert cell
lmdata = data.filter(d=> d.Year >= regression_start_year)


Insert cell
Insert cell
// Import Plot with additional tooltip functionality from this notebook
import {Plot} from "@mkfreeman/plot-tooltip"
Insert cell
Insert cell
Insert cell
data = FileAttachment("daytona_24_overall_winners.csv").csv({typed: true})
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