Public
Edited
May 13
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
grafico1 = {
return vl.markBar()
.data(countries)
.encode(
vl.x().fieldN("country").sort("-y"),
vl.y().fieldQ("life_expect").aggregate("mean").title("Expectativa de Vida Média"),
vl.tooltip([
{ field: "country", type: "nominal", title: "País" },
{ field: "life_expect", type: "quantitative", aggregate: "mean", title: "Média de Expectativa de Vida" }
])
)
.width(1200)
.height(800)
.render();
}

Insert cell
Insert cell
grafico2 = {
const scatter = year =>
vl.markCircle()
.data(countries)
.transform(
vl.filter(`datum.year === ${year}`)
)
.encode(
vl.x().fieldQ('fertility').title('Fertilidade'),
vl.y().fieldQ('life_expect').title('Expectativa de Vida'),
vl.tooltip(['country', 'fertility', 'life_expect'])
)
.width(250)
.height(300)
.title(`Ano ${year}`);

return vl.hconcat(
scatter(1980),
scatter(1990),
scatter(2000)
).render();
}

Insert cell
Insert cell
https://ghmonteiro30.github.io/VISUALIZACAO/
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