When using a colorQuantile color palette, is it be possible to have the legend show the numeric values corresponding to the percentile ranges instead of the percentile ranges themselves?
You can do it by providing your own labFormat function:
leaflet() %>% addLegend(pal=colorQuantile("Blues", 1:10), values=1:10, labFormat = function(type, cuts, p) {
n = length(cuts)
p = paste0(round(p * 100), '%')
cuts = paste0(formatC(cuts[-n]), " - ", formatC(cuts[-1]))
# mouse over the legend labels to see the percentile ranges
paste0(
'<span title="', p[-n], " - ", p[-1], '">', cuts,
'</span>'
)
})
Thanks so much for the quick response!
Most helpful comment
You can do it by providing your own labFormat function: