Published
Edited
Apr 3, 2019
Insert cell
Insert cell
Insert cell
Insert cell
// Load a file locally
viewof text = html`<input type=file * ">`
// I could not get this to work so I just made a gist!
Insert cell
Insert cell
Insert cell
// your code here
counts = z.valueCounts(Object.values(z.getCol("location", tweets)))
Insert cell
Insert cell
Insert cell
Insert cell
viewof location_histogram = embed({
data: {values: tweets_cleaned}, // indexed for each group
mark: "bar",
encoding: {
x: {
field: 'location',
type:'ordinal',
"sort": {"op": "count", "field": "location", 'order':'descending'}
},
y: {aggregate: "count", type: "quantitative"}
}
})
Insert cell
Insert cell
viewof location_scatterd = embed ({
"selection": {
"grid": {
"type": "interval", "bind": "scales"
}
},
width: 800,
height: 800,
"data": {values: tweets_cleaned},
"mark": "point",
"encoding": {
"y": {"field": "lat","type": "quantitative", "scale": {"domain": [42.34, 42.371]}},
"x": {"field": "lon","type": "quantitative", "scale": {"domain": [-71.15, -71.03]}}
}
})
Insert cell
Insert cell
// Load a file locally
viewof hashtag_text = html`<input type=file * ">`
// I could not get this to work so I just made a gist!
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
viewof location_scatterd_2 = embed ({
"selection": {
"grid": {
"type": "interval", "bind": "scales"
}
},
title: "Tweets by search term 'park'",
width: 800,
height: 800,
"data": {values: hashtag_tweets_cleaned},
"mark": {"type": "point", "filled": true},
"encoding": {

"y": {"field": "lat","type": "quantitative"},
"x": {"field": "lon","type": "quantitative"},
"color": {"field": "num_hashtags", "type": "nominal"},
"size": {"field": "num_hashtags", "type": "nominal"},
"tooltip": [
{"field": "location", "type": "ordinal"},
{"field": "content", "type": "ordinal"}
]
}
})
Insert cell
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