Public
Edited
Oct 17, 2023
Insert cell
Insert cell
data = FileAttachment("Number of papers 2019-2021@1.csv").csv({ typed: true })
Insert cell
numberOfPaperschart = Plot.plot({
marginLeft: 150,
x: { grid: true, domain: [0, 500_000], label: "Number of papers" },
marks: [
Plot.barX(
data.filter((d) => d.measure === "Number of papers"),
{
x: "value",
y: "country_english",
fill: (d) => (d["country_english"] === "Japan" ? "#eb5b25" : "#36a9e1"),
sort: { y: "x", reverse: true }
}
),
Plot.ruleX([0])
]
})
Insert cell
top10chart = Plot.plot({
marginLeft: 150,
x: { grid: true, domain: [0, 60_000], label: "Top 10%" },
marks: [
Plot.barX(
data.filter((d) => d.measure === "Top 10%"),
{
x: "value",
y: "country_english",
fill: (d) => (d["country_english"] === "Japan" ? "#eb5b25" : "#36a9e1"),
sort: { y: "x", reverse: true }
}
),
Plot.ruleX([0])
]
})
Insert cell
top1chart = Plot.plot({
marginLeft: 150,
x: { grid: true, domain: [0, 60_000], label: "Top 1%" },
marks: [
Plot.barX(
data.filter((d) => d.measure === "Top 1%"),
{
x: "value",
y: "country_english",
fill: (d) => (d["country_english"] === "Japan" ? "#eb5b25" : "#36a9e1"),
sort: { y: "x", reverse: true }
}
),
Plot.ruleX([0])
]
})
Insert cell
dataShare = FileAttachment("share of papers 2008-2020.csv").csv({ typed: true })
Insert cell
share1chart = Plot.plot({
marginLeft: 150,
x: { grid: true, domain: [0, 25], label: "Share of papers" },
marks: [
Plot.barX(
dataShare.filter((d) => d.year === "2008-2010"),
{
x: "vaule",
y: "country_english",
fill: (d) => (d["country_english"] === "Japan" ? "#eb5b25" : "#36a9e1"),
sort: { y: "x", reverse: true }
}
),
Plot.ruleX([0])
]
})
Insert cell
share2chart = Plot.plot({
marginLeft: 150,
x: { grid: true, domain: [0, 25], label: "Share of papers" },
marks: [
Plot.barX(
dataShare.filter((d) => d.year === "2018-2020"),
{
x: "vaule",
y: "country_english",
fill: (d) => (d["country_english"] === "Japan" ? "#eb5b25" : "#36a9e1"),
sort: { y: "x", reverse: true }
}
),
Plot.ruleX([0])
]
})
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