Public
Edited
Jun 2
Insert cell
Insert cell
Insert cell
insurance = FileAttachment("insurance.csv").csv()
Insert cell
Insert cell
vl.markCircle()
.data(insurance)
.encode(
vl.x().fieldQ("bmi").title("BMI"),
vl.y().fieldQ("charges").title("Insurance Charges"),
vl.color().fieldN("smoker").title("Smoker"))
.width(500)
.height(400)
.title("Relationship Between BMI and Insurance Charges")
.render()
Insert cell
Insert cell
Insert cell
vl.markPoint()
.data(insurance)
.encode(
vl.x().fieldQ("bmi").title("BMI"),
vl.y().fieldQ("charges").title("Insurance Charges"),
vl.color().fieldN("sex").title("Sex"),
vl.shape().fieldN("smoker").title("Smoker"))
.width(500)
.height(400)
.title("Insurance Charges vs BMI by Sex and Smoker Status")
.render()
Insert cell
Insert cell
Insert cell
viewof colorField = Inputs.select(["sex", "smoker", "region"], {label: "Color by"})
Insert cell
vl.markCircle()
.data(insurance)
.encode(
vl.x().fieldQ("bmi").title("BMI"),
vl.y().fieldQ("charges").title("Insurance Charges"),
vl.color().fieldN(colorField),
vl.tooltip(["age", "bmi", "charges"])
)
.width(500)
.height(400)
.title("Relationship Between BMI and Insurance Charges based on Different Factors")
.render()
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