Public
Edited
Mar 17, 2023
4 stars
Insert cell
Insert cell
drugs.csv
Type Table, then Shift-Enter. Ctrl-space for more options.

Insert cell
Plot.plot({
marks: [
Plot.gridX({ stroke: "black" }),
Plot.dot(
drugs,
Plot.dodgeY({
x: "marketing_authorisation_date",
fill: "authorisation_status",
title: "medicine_name",
// center points in swarm
anchor: "middle",
r: 5
})
),
//customize X axis
Plot.axisX({ tickSize: 0, fontSize: 15, fontFamily: "Menlo" })
],
height: 600,
width: 1200,
marginBottom: 50,
color: { type: "categorical", scheme: "brbg", legend: true }
})
Insert cell
Insert cell
Plot.plot({
marks: [
Plot.barX(
drugs,
Plot.groupY(
{ x: "count" },
{
y: "active_substance",
fill: "#53868B",
sort: {
y: "x",
reverse: true,
limit: 10
}
}
)
),
Plot.ruleX([0]),
Plot.axisY({ tickSize: 0, fontSize: 15, fontFamily: "Menlo" })
],
height: 500,
width: 800,
marginLeft: 150
})
Insert cell
Insert cell
Plot.plot({
marks: [
Plot.barX(
drugs,
Plot.groupY(
{ x: "count" },
{
y: "marketing_authorisation_holder_company_name",
fill: "#CDAD00",
sort: { y: "x", reverse: true, limit: 10 }
}
)
),
Plot.ruleX([0]),
Plot.axisY({ tickSize: 0, fontSize: 15, fontFamily: "Menlo" })
],
height: 500,
width: 800,
marginLeft: 300,
color: { type: "categorical", scheme: "dark2" }
})
Insert cell
drugs
select year(marketing_authorisation_date) as auth_year, count(*) as count
from drugs
where auth_year >= 1995
group by auth_year

Insert cell
Insert cell
Plot.plot({
marks: [
Plot.ruleY([0]),
Plot.lineY(year_wise, { x: "auth_year", y: "count" }),
Plot.dot(year_wise, {
x: "auth_year",
y: "count"
})
]
})
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