addPopupGraphs: Add graph/plot popups to leaflet layers.

View source: R/addPopupGraphs.R

addPopupGraphsR Documentation

Add graph/plot popups to leaflet layers.

Description

Add graph/plot popups to leaflet layers.

Usage

addPopupGraphs(map, graph, group, width = 300, height = 300, ...)

Arguments

map

the leaflet map to add the popups to.

graph

A list of lattice or ggplot2 objects. Needs to be a list, even for a single plot!

group

the map group to which the popups should be added.

width

the width of the graph(s) in pixels.

height

the height of the graph(s) in pixels.

...

additional arguments passed to addPopupImages.

Value

A leaflet map.

Examples

if (interactive()) {
library(sf)
library(leaflet)
library(lattice)

pt = data.frame(x = 174.764474, y = -36.877245)
pt = st_as_sf(pt, coords = c("x", "y"), crs = 4326)

p2 = levelplot(t(volcano), col.regions = terrain.colors(100))

leaflet() %>%
  addTiles() %>%
  addCircleMarkers(data = pt, group = "pt") %>%
  addPopupGraphs(list(p2), group = "pt", width = 300, height = 400)

}


r-spatial/leafpop documentation built on June 21, 2022, 6:48 p.m.