vega({
data: { values: wikipediatop20 },
height: 500,
padding: 50,
title: {
text: [
"Top 20 (word count) Wikipedia articles that mention 'Canada' and 'Christmas'"
],
subtitle: ["Includes only the first 10,000 'most relevant' results"],
fontSize: 22
},
hconcat: [
{
width: 300,
mark: { type: "bar", tooltip: true, fill: "green" },
encoding: {
y: {
field: "Title",
axis: {
labelFontSize: 14,
titleFontSize: 18,
labelLimit: 300,
title: false
},
sort: "-Words"
},
x: {
type: "quantitative",
field: "Christmas Mentions",
axis: { labelFontSize: 14, titleFontSize: 18 }
}
}
},
{
width: 300,
mark: { type: "bar", tooltip: true, fill: "red" },
encoding: {
y: {
field: "Title",
axis: false,
sort: "-Words"
},
x: {
type: "quantitative",
field: "Canada Mentions",
axis: { labelFontSize: 14, titleFontSize: 18 }
}
}
}
]
})