Weird label placement in leaflet maps in xarigan slide deck


Please consider the R chunks included in the xarigan Rmd setup shown below.

When I execute this code in a vanilla R script in RStudio and hover my mouse cursor on top of the markers in the Viewer tab, the pop-up labels show up right next to the cursor ... that is, right where I would expect them to be.

Now, when one renders the Rmd into a html file and repeats the experience of hovering the mouse cursor on top of the markers, one can see that the labels show at a larger and variable distance from the markers. This issue is even more pronounced in the map I am working on (I can't show) in which the distance between markers and pop-up could be as far a 1 inch.

How can I correct this behavior?

Thank you in advance for your feedback

title: "Leaflet in xaringan"
subtitle: "Weird label placement"
author: "pomchip"
date: "2016/12/12 (updated: `r Sys.Date()`)"
    lib_dir: libs
      highlightStyle: github
      highlightLines: true
      countIncrementalSlides: false


quakes$mag <- sprintf('Magntiude: %s', quakes$mag)

# a working path to icon & shadow, hosted on
marker_icon <- makeIcon(
  iconUrl = "",
  shadowUrl = "",

m <- leaflet(data = quakes[1:20,]) %>%
  addTiles() %>%
             icon = marker_icon,
             popup = ~as.character(mag),
             label = ~as.character(mag))  


```{r, echo = FALSE, out.width = '100%'}

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.