Public
Edited
May 8, 2023
Insert cell
Insert cell
gender.csv
Type Table, then Shift-Enter. Ctrl-space for more options.

Insert cell
genderEqualityFile = FileAttachment("gender.csv")
Insert cell
genderEquality = genderEqualityFile.csv()
Insert cell
printTableTypes(genderEquality)
Insert cell
genderEqualityTyped = genderEqualityFile.csv({typed: true})
Insert cell
printTableTypes(genderEqualityTyped)
Insert cell
vl.markCircle()
.data(genderEqualityTyped)
.title("Male Life Expectancy at Birth For Different Countries (1960-2019)")
.encode(
vl.x().fieldO('Year'),
vl.y().fieldQ('average_value_Life expectancy at birth, male (years)').title("Average Male Life Expectancy At Birth (Years)"),
vl.color().fieldN('Country Name')
)
.width(800).height(400)
.render()

Insert cell
vegalite({
width: 800,
height: 400,
data: {values: genderEqualityTyped},
mark: 'circle',
encoding: {
x: {field: 'Year', type: 'ordinal'},
y: {field: 'average_value_Life expectancy at birth, male (years)', type: 'quantitative'}
},
transform: {field: "Country Name", equal: "Belgium"}
})
Insert cell
import {vl} from '@vega/vega-lite-api-v5'
Insert cell
import {printTable} from '@jonfroehlich/data-utilities'
Insert cell
import {printTableTypes} from '@jonfroehlich/data-utilities'
Insert cell
import {vegalite} from '@jonfroehlich/vega-lite-utilities'
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