1 year ago
#69278

aholtz
MiniCharts Library in R Leaflet- Popup Legend Options
I am using the minicharts package (https://www.rdocumentation.org/packages/leaflet.minicharts/versions/0.6.2) in a leaflet map of mine. It works as expected, however, I wish I could adjust the pop up and legend titles and values. You can see my leaflet map below:
I would like the values in the pop up to have % sign after. This would require turning this value into a string. The values, however, have to remain as doubles for the minicharts to read the value and produce the pie chart. Another option would be to set a title for the popup, ex. Sequence % per variant. This would work as well. It would also be handy, if the variants would only show in the popup if they were greater than 0. Lastly, I would also like to set a legend title for the legend on the right side, which shows what colors of the pie chart correspond to which variants.
The code is below:
final_variant <- final_variant %>%
addMinicharts(
JointLabel$long, JointLabel$lat,
type = "pie",
chartdata = JointLabel[, c("Alpha_B.1.1.7",
"B.1.1.7.E484",
"Beta_B.1.351",
"Gamma_P.1",
"Omicron_B.1.1.529",
"B.1.617",
"Kappa_B.1.617.1",
"Delta_B.1.617.2",
"Mu_B.1.621",
"other"
)],
colorPalette = colors,
popupOptions = list(closeButton = FALSE, showTitle = TRUE),
width = 30
)
final_variant is just a map file from the spatial file of Europe. I can provide this too, if needed. Thank you for any help
javascript
r
leaflet
0 Answers
Your Answer