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

One platform to build and deploy the best data apps

Experiment and prototype by building visualizations in live JavaScript notebooks. Collaborate with your team and decide which concepts to build out.
Use Observable Framework to build data apps locally. Use data loaders to build in any language or library, including Python, SQL, and R.
Seamlessly deploy to Observable. Test before you ship, use automatic deploy-on-commit, and ensure your projects are always up-to-date.
Learn more