Open fgregg opened 2 months ago
It should be possible to simplify a little:
Plot.plot({
y: { percent: true },
marks: [
Plot.ruleY([0]),
Plot.line(
caseLength,
Plot.normalizeY(
(arr) => arr.length,
Plot.mapY("cumsum", {
sort: "case_length",
reverse: true,
x: "case_length",
y: (d) => (d.case_length === null ? 0 : 1),
curve: "step-after"
})
)
)
]
})
I think this is more for an example (or an essay explaining how it's used), rather than as a built-in transform?
It would be great to have support of kaplan-meier curve, perhaps in the
Plot.map
family.As the curve is basically a cumulative sum with some transformations, it shouldn't be too hard.
This code gives a pretty good approxmation:
If interested, I can work on something that extends Plot.map