Public
Edited
Aug 7, 2024
Insert cell
Insert cell
{
const y2 = d3.scaleLinear(
d3.extent(counsellors, (d) => d.Counsellors),
[0, d3.max(users, (d) => d.Users)]
);
return Plot.plot({
title: "BetterHelp user declines lead to counsellor declines",
caption:
"We can see that counsellors numbers lag user numbers by around a year. This strongly suggests that user growth induces counsellors demand and vice-versa, rather than users being constrained by a shortage of counsellors.",
marginLeft: 50,
marginRight: 45,
y: {
axis: "left",
label: "Users",
domain: [250000, 500000],
ticks: 7,
grid: true,
tickFormat: "s"
},
marks: [
Plot.axisY(y2.ticks(), {
color: "#3a7a4b",
anchor: "right",
label: "Counsellors",
y: y2,
tickFormat: "s"
}),
Plot.lineY(users, { x: "Date", y: "Users", tip: true }),
Plot.lineY(
counsellors.filter((d) => d.Date >= d3.min(users, (d) => d.Date)),
Plot.mapY((D) => D.map(y2), {
x: "Date",
y: "Counsellors",
stroke: "#3a7a4b",
tip: true
})
)
]
});
}
Insert cell
import { data as users } from "@huw/betterhelp-earnings"
Insert cell
import { data as counsellors } from "@huw/betterhelp-counsellors"
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