mapview provides a few special popup rendering functions. These can be used to generate:

  • attribute table popups
  • graph popups (i.e. plots in popups)
    • static (ggplot2, lattice, base)
    • interactive (htmlwidgets)
  • image popups

Attribute table popups

popupTable is the standard popup function used in mapview. It provides a static table rendering of all attributes of the individual features.

## Attaching package: 'leafpop'
## The following objects are masked from 'package:mapview':
##     popupGraph, popupImage, popupTable
mapview(breweries, popup = popupTable(breweries,
                                      zcol = c("brewery",

This can also be used with leaflet maps

leaflet() %>%
  addTiles() %>%
  addCircleMarkers(data = breweries,
                   popup = popupTable(breweries))

Graph popups

popupGraph allows us to include static or interactive (htmlwidgets) plots in popups. In the following example we will show a scatterplot of copper ~ cadmium for each individual feature of the famous meuse data set


coordinates(meuse) <- ~x+y
proj4string(meuse) <- CRS("+init=epsg:28992")

p <- xyplot(copper ~ cadmium, data = meuse@data, col = "grey", pch = 20, cex = 2)
p <- mget(rep("p", length(meuse)))

clr <- rep("grey", length(meuse))
p <- lapply(1:length(p), function(i) {
  clr[i] <- "red"
  update(p[[i]], col = clr)

        zcol = "cadmium",
        popup = popupGraph(p))