Public
Edited
Jun 17
Insert cell
Insert cell
import {vl} from "@vega/vega-lite-api-v5"
Insert cell
import {uniqueValid} from "@uwdata/data-utilities"
Insert cell
df = FileAttachment("all_games@4.csv").csv()
Insert cell
platforms = uniqueValid(df, d => d.platform)
Insert cell
reviewers = uniqueValid(df, d => d.meta_score)
Insert cell
all_games@5.csv
Type Table, then Shift-Enter. Ctrl-space for more options.

Insert cell
Insert cell
Insert cell
Insert cell
{
// point-value selection over [Major_Genre, MPAA_Rating] pairs
// use specific hard-wired values as the initial selected values
const selection = vl.selectPoint('Select')
.fields('platform')
.init({platform: " 3DS"})
.bind({platform: vl.radio(platforms)});
// scatter plot, modify opacity based on selection
return vl.markCircle()
.data(df)
.params(selection)
.encode(
vl.x().fieldQ('user_review').title('User Score'),
vl.y().fieldQ('meta_score').title('Metacritic Score'),
vl.tooltip([
{field:'user_review', title:'User Score'},
{field:'meta_score', tile:'Metacritic score'},
{field: 'name', title:'Name'}
]),
vl.opacity().if(selection, vl.value(0.95)).value(0.01),
)
.render();
}
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