vega({
$schema: "https://vega.github.io/schema/vega-lite/v4.json",
height: 500,
width: 700,
title: {
text: [
`Helpfulness rating counts for community notes containing the word "Poilievre"`
],
subtitle: ["Pulled on October 14, 2023"],
subtitleColor: "f4f4f4"
},
data: {
values: pollivrehelpful1.map((d) => {
return { noteAndTweetID: d.tweetId + "-" + d.noteId, ...d };
})
},
mark: { type: "bar", tooltip: true },
encoding: {
y: {
field: "cnt",
type: "quantitative",
axis: { grid: false }
},
x: {
field: "noteAndTweetID",
type: "nominal",
axis: false,
sort: "-y"
},
color: {
field: "helpfulnessLevel",
type: "nominal",
sprt: "y",
legend: { orient: "top" }
}
}
})