Published
Edited
Sep 30, 2019
Fork of Regression
Insert cell
Insert cell
Insert cell
Insert cell
html`
error: ${Math.abs(113.7 - (slope*456+intercept))}
`
Insert cell
vl.layer(datapoints,line,endpoints,error).render()
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
line = vl.markLine({stroke:"red"})
.data([{x:0,y:y1},{x:500,y:y2}])
.encode(
vl.x().fieldQ("x"),
vl.y().fieldQ("y").scale({domain:[0,140]})
)

Insert cell
endpoints = vl.markCircle({fill:"aqua",stroke:"black",size:200})
.data([{x:0,y:y1},{x:500,y:y2}])
.encode(
vl.x().fieldQ("x"),
vl.y().fieldQ("y").scale({domain:[0,140]})
)

Insert cell
error = vl.markLine({stroke:"black",strokeDash:[5,2]})
.data([{x:456,y:113.7},{x:456,y:slope*456+intercept}])
.encode(
vl.x().fieldQ("x"),
vl.y().fieldQ("y").scale({domain:[0,140]})
)
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