Published
Edited
Sep 30, 2019
Fork of Regression
Insert cell
Insert cell
Insert cell
Insert cell
vl.layer(dataPoints,line,endpoints,errorline).render()
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
dataFilt=data.filter(d=>d.x>=150)
Insert cell
dataPoints=vl.markCircle()
.data(dataFilt)
.encode(
vl.x().fieldQ("x"),
vl.y().fieldQ("y").scale({domain:[0,140]})
)
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")
)
Insert cell
endpoints=vl.markCircle({size:200,stroke:"black",fill:"aqua"})
.data([{x:0,y:y1},{x:500,y:y2}])
.encode(
vl.x().fieldQ("x"),
vl.y().fieldQ("y")

)
Insert cell
errorline=vl.markLine({stroke:"black",strokeDash:[5,2]})
.data([{x:456,y:113.7},{x:456,y:456*slope+intercept}])
.encode(
vl.x().fieldQ("x"),
vl.y().fieldQ("y").scale({domain:[0,140]})

)
Insert cell
intercept=y1
Insert cell
slope=(y2-y1)/500
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