Open LukasWallrich opened 2 years ago
There's an abandoned PR about this: #59. Feel free to pick up and finish off.
I understand that PR as wanting to add weights to the density calculation - not to the quantile lines? Would one solve the other? Then I'd certainly want to investigate.
Oh, sorry, I didn't read carefully enough. Those are two separate issues. It's possible already though to provide your own quantile function. Does that help?
Not cleanly - I would like to use a weighted.median(x, weight) function, but can't pass the weight in there.
As a workaround, I could probably calculate the desired outputs first and then use x just as a lookup value in my own function ... these vectors better be unique for each y value. That obviously is rather hacky ... but good enough for now. If I get to understand the ggplot2 architecture properly at some point, I will return with a PR.
I would like to show weighted medians in
geom_density_ridges().
The most intuitive way to get there would be to passx
andweight
to myquantile_fun
... but I don't think that is possible at present.Unless I am overlooking a simpler solution, might that be a worthwhile enhancement? I could also see use cases where it would be helpful to have
y
within that function, for instance, to show different thresholds depending ony
...