0

How can you add an x and y axis to a leaflet map figure -- in the case of a map how to add the longitude and latitude?

For the figure below, how can axis be added please?

library(leaflet)

leaflet() %>%
  addTiles() %>%  
  addMarkers(lng=174.768, lat=-36.852, popup="The birthplace of R")

enter image description here

user2957945
  • 2,353
  • 2
  • 21
  • 40
  • You are probably looking for this leafletjs plugin https://github.com/dtutic/Leaflet.EdgeScaleBar. But it has not yet been incorporated into a leaflet R plugin (that I know of). The closest and easiest to implement is the built-in graticule plugin. https://rstudio.github.io/leaflet/morefeatures.html#graticule – rbasa Jun 17 '21 at 13:09
  • Thanks @rbasa. Details to extending are given at https://rstudio.github.io/leaflet/extending.html. I may have a bash. – user2957945 Jun 17 '21 at 14:51
  • leaflet::addGraticule() gets you part way there, but only at smaller scales. – gvan Jul 09 '21 at 12:05

0 Answers0