Published unlisted
Edited
Feb 13, 2022
Insert cell
Insert cell
snitchesAll = FileAttachment("twittysnitches-parsed@1.json").json()

Insert cell
snitches = snitchesAll.filter(d => !d.error);
Insert cell
followers = FileAttachment("followers.json").json()

Insert cell
snitchesWithFollowers = snitches.map(s => {
return {
isFromFollowed: followers.some(d => s.authorHandle && d.handle === "@" + s.authorHandle),
...s
}
});
Insert cell
Inputs.table(snitchesWithFollowers)
Insert cell
Plot.rect(snitchesWithFollowers, Plot.bin({fill: "count"}, {x: "likes", y: "retweets"})).plot({
x: {
type: "log",
base: 10,
grid:true
},
y: {
type: "log",
base: 10
}
})
Insert cell
Plot.dot(snitchesWithFollowers, {x: "likes", y: "retweets", fill:d => d.isFromFollowed ? "followed" : "stranger"}).plot({
x: {
type: "log",
base: 2,
},
y: {
type: "log",
base: 2
},
color: {
domain: ["stranger", "followed"],
range: ["rgb(78 121 167 / 50%)", "rgb(242 142 44 / 50%)"],
legend: true
},
})
Insert cell

Plot.dot(snitchesWithFollowers.filter(d => d.retweets < 50000), Plot.bin({r: "count"},{x: "likes", y: "retweets", fill:d => d.isFromFollowed ? "followed" : "stranger"})).plot({

color: {
domain: ["stranger", "followed"],
range: ["rgb(78 121 167 / 50%)", "rgb(242 142 44 / 50%)"],
legend: true
},
})
Insert cell
Plot.rectY(snitchesWithFollowers.filter(d => d.retweets < 50000), Plot.binX({y: "count"}, {x: "retweets", fill:d => d.isFromFollowed ? "followed" : "stranger", thresholds: 'scott'})).plot({
color: {
domain: ["stranger", "followed"],
range: ["rgb(78 121 167 / 80%)", "rgb(242 142 44 / 80%)"],
legend: true
},
});
Insert cell
Plot.rectY(snitchesWithFollowers, Plot.binX({y: "count"}, {x: "retweets", fill:d => d.isFromFollowed ? "followed" : "stranger", thresholds: 'scott'})).plot({
x: {
type: "log",
base: 2,
},
color: {
domain: ["stranger", "followed"],
range: ["rgb(78 121 167 / 80%)", "rgb(242 142 44 / 80%)"],
legend: true
},
});
Insert cell
Type JavaScript, then Shift-Enter. Ctrl-space for more options. Arrow ↑/↓ to switch modes.

Insert cell
Type JavaScript, then Shift-Enter. Ctrl-space for more options. Arrow ↑/↓ to switch modes.

Insert cell
Plot.rectY(snitchesWithFollowers.filter(d => d.retweets < 500), Plot.binX({y: "count"}, {x: "retweets", fill:d => d.isFromFollowed ? "followed" : "stranger", thresholds: 'freedman-diaconis'})).plot({
color: {
domain: ["stranger", "followed"],
range: ["rgb(78 121 167 / 80%)", "rgb(242 142 44 / 80%)"],
legend: true
},
});
Insert cell
Plot.rectY(snitchesWithFollowers.filter(d => d.retweets < 500), Plot.binX({y: "count"}, {x: "likes", fill:d => d.isFromFollowed ? "followed" : "stranger", thresholds: 'freedman-diaconis'})).plot({
color: {
domain: ["stranger", "followed"],
range: ["rgb(78 121 167 / 80%)", "rgb(242 142 44 / 80%)"],
legend: true
},
});
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