Published
Edited
Dec 23, 2021
7 stars
Insert cell
Insert cell
Insert cell
import {df} from "@uwdata/introduction-to-vega-lite"
Insert cell
plot = vl.markPoint()
.data(df)
.encode(
vl.x().fieldQ('precip'),
vl.y().fieldN('city')
)
Insert cell
plot.render()
Insert cell
Insert cell
object = plot.toObject()
Insert cell
string = JSON.stringify(object, 0, 2)
Insert cell
Insert cell
embed = require("vega-embed@6")
Insert cell
Insert cell
embed(object)
Insert cell
embed(JSON.parse(string))
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