ggplot2
ggplot2 copied to clipboard
Change density default `bw = "nrd0"` to `bw = "sj"`
This PR aims to fix #3825.
Briefly, ?density
recommends the "sj"
method over the "nrd0"
default. This change propagates that recommendation to ggplot2's density calculations.
Some details:
- Understandably, plenty of snapshots have changed.
- I realised that
calc_bw()
andprecompute_bw()
were doing the exact same task, so I merged these. - When
var(x) == 0
, most of thestats::bw.*()
functions throw an error, so we keepbw.nrd0()
for these degenerate cases because it will not throw an error.