How do you include a superscript in you leaflet legend title in R?
pal1 <- colorFactor("YlGn", domain = dataset$varaible, n = 3)
dataset %>% leaflet() %>%
addProviderTiles("CartoDB.PositronNoLabels") %>%
addPolygons(weight = 0.25, stroke = TRUE, color = "black", fillColor = ~pal1(dataset$variable), label = ~paste0("SCORE: ", variable)) %>%
addLegend("bottomright", pal = pal1, values = ~variable, title = "ICE Race)
I would like the 'Race' to be a superscript. Thanks!
You could achieve your desired result by wrapping Race
in a <sup>
tag.
Using some fake example data based on mtcars
:
library(leaflet)
dataset <- mtcars[, "cyl", drop = FALSE]
names(dataset) <- "variable"
pal1 <- colorFactor("YlGn", domain = dataset$variable, n = 3)
dataset %>%
leaflet() %>%
addProviderTiles("CartoDB.PositronNoLabels") %>%
addLegend("bottomright",
pal = pal1,
values = ~variable, title = "ICE<sup>Race</sup>"
)