0

What is please the simples way to add title to a leaflet map object?

I would like to add title to a leaflet map that I have and also wanted to ask about saving as pdf.

When saving as pdf (in example) the map if cut off and there is a lot of empty space in pdf, is there a way how to solve this as well?

library(leaflet)
library(ggplot2)
library(sf)
library(spdep)
library(leaflet.minicharts)
library(leafletCN)
library(mapview)


# Regions of each country selected

URL <- "https://biogeo.ucdavis.edu/data/gadm3.6/Rsp/gadm36_DEU_1_sp.rds"
data <- readRDS(url(URL))


m <- 
  leaflet() %>% addProviderTiles("CartoDB.Positron") %>% 
  addPolygons(data=data, weight = 1, fill = F, color = "red")

mapshot(m, file = "m.pdf")


IvanSanchez
  • 18,272
  • 3
  • 30
  • 45
Petr
  • 1,606
  • 2
  • 14
  • 39
  • Does this answer your question? [R: Add title to Leaflet map](https://stackoverflow.com/questions/49072510/r-add-title-to-leaflet-map) – Wilmar van Ommeren Jan 08 '20 at 10:31
  • Hi, it does answer my firts question, I knew about "trick" when you use legend for it but I tought that there is a different approch... part about PDF saving is NOT answered. – Petr Jan 08 '20 at 16:09

0 Answers0