You can pass "accuracy" to scales::percent
, e.g.
library(scales)
count = seq(0, 10, 1)
label = scales::percent(cumsum((count / sum(count))), accuracy = 0.001)
label
>[1] "0.000%" "1.818%" "5.455%" "10.909%" "18.182%"
>[6] "27.273%" "38.182%" "50.909%" "65.455%" "81.818%"
>[11] "100.000%"
label = scales::percent(cumsum((count / sum(count))), accuracy = 0.01)
label
>[1] "0.00%" "1.82%" "5.45%" "10.91%" "18.18%"
>[6] "27.27%" "38.18%" "50.91%" "65.45%" "81.82%"
>[11] "100.00%"
So, with your data, I think this should work:
label = after_stat(scales::percent(cumsum((count / sum(count))), accuracy = 0.01))
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…