Published
Edited
Aug 3, 2018
Importers
14 stars
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
winsMetascores = _.map(data, d => {
// Nominated for 1 Oscar. Another 11 wins & 21 nominations.
let wins = d.Awards.match(/(\d+) win/);
wins = wins ? wins[1] : 0;
return {
wins: +wins,
score: +d.Metascore,
title: d.Title,
}
})
Insert cell
vegalite({
data: {values: winsMetascores},
mark: 'point',
encoding: {
y: {
type: 'quantitative',
field: 'score',
scale: {type: 'log'},
},
x: {
type: 'quantitative',
field: 'wins',
},
}
})
Insert cell
Insert cell
yearScoreGenre = _.map(data, d => {
return {
date: new Date(d.Released),
score: +d.Metascore,
genre: d.Genre ? d.Genre.split(', ')[0] : '',
}
})
Insert cell
Insert cell
monthGenrePopularity = _.chain(data)
.map(d => {
return _.map( d.Genre.split(', '), genre => {
return {
date: new Date(d.Released),
genre,
votes: +(d.imdbVotes.replace(/\,/g, '')),
}
})
}).flatten().value()
Insert cell
Insert cell
vegalite({
data: {values: monthGenrePopularity},
mark: 'rect',
encoding: {
x: {field: 'date', type: 'ordinal', timeUnit: 'month'},
y: {field: 'genre', type: 'nominal'},
color: {type: 'quantitative', aggregate: 'max', field: 'votes'},
}
})
Insert cell
Insert cell
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