Public
Edited
May 14
Insert cell
Insert cell
Insert cell
Insert cell
countries = data['countries.json']()
Insert cell
countries
Type Table, then Shift-Enter. Ctrl-space for more options.

Insert cell
Insert cell
exercicio1 = vl.markBar({color: 'purple'})
.data(countries)
.encode(
vl.x().average('fertility'),
vl.y().fieldN('country').sort('-x')
)
.render()
Insert cell
Insert cell
exercicio2 = vl.hconcat(
vl.markPoint()
.data(countries)
.transform(vl.filter("datum.year == 1980"))
.encode(
vl.x().fieldQ("fertility"),
vl.y().fieldQ("life_expect"),
vl.color({ value: "Brown" }),
vl.tooltip(["fertility", "life_expect", "country"])
)
.title("Ano: 1980"),

vl.markPoint()
.data(countries)
.transform(vl.filter("datum.year == 1990"))
.encode(
vl.x().fieldQ("fertility"),
vl.y().fieldQ("life_expect"),
vl.color({ value: "Brown" }),
vl.tooltip(["fertility", "life_expect", "country"])
)
.title("Ano: 1990"),

vl.markPoint()
.data(countries)
.transform(vl.filter("datum.year == 2000"))
.encode(
vl.x().fieldQ("fertility"),
vl.y().fieldQ("life_expect"),
vl.color({ value: "Brown" }),
vl.tooltip(["fertility", "life_expect", "country"])
)
.title("Ano: 2000")

// Pensei em diferenciar a cor de cada um, mas por
// se tratar de scatterplot, achei que com a mesma
// cor fica mais fácil de comparar os anos
).render()
Insert cell
Insert cell
[link](https://kclanoce.github.io/datavis2025/)
Insert cell
import {vl} from '@vega/vega-lite-api-v5'
Insert cell
data = require('vega-datasets')
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