library(leaflet)
## default position is topleft next to zoom control
img <- "https://www.r-project.org/logo/Rlogo.svg"
leaflet() %>% addTiles() %>% addLogo(img, url = "https://www.r-project.org/logo/")
## with local image
if (requireNamespace("png")) {
library(png)
img <- system.file("img", "Rlogo.png", package="png")
leaflet() %>% addTiles() %>% addLogo(img, src = "local", alpha = 0.3)
## dancing banana gif :-)
m <- leaflet() %>%
addTiles() %>%
addCircleMarkers(data = breweries91)
addLogo(m, "https://jeroenooms.github.io/images/banana.gif",
position = "bottomleft",
offset.x = 5,
offset.y = 40,
width = 100,
height = 100)
}
Run the code above in your browser using DataLab