- Notifications
You must be signed in to change notification settings - Fork15
Include Tables, Images and Graphs in Leaflet Popups
License
r-spatial/leafpop
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
leafpop creates HTML strings to embed tables, images or graphs inpopups of interactive maps created with packages ‘leaflet’ or ‘mapview’.Handles local paths to images on the file system or remote urls. Handlesgraphs created with ‘base’ graphics, ‘lattice’ or ‘ggplot2’ as well asinteractive plots created with ‘htmlwidgets’.
You can install the released version ofleafpop fromCRAN with:
install.packages("leafpop")Or the development version from GitHub:
# install.packages("devtools")devtools::install_github("r-spatial/leafpop")
library(leaflet)leaflet() %>% addTiles() %>% addCircleMarkers(data=breweries91,popup= popupTable(breweries91))
library(sf)library(leaflet)pnt= st_as_sf(data.frame(x=174.764474,y=-36.877245),coords= c("x","y"),crs=4326)img="http://bit.ly/1TVwRiR"leaflet() %>% addTiles() %>% addCircleMarkers(data=pnt,group="pnt") %>% addPopupImages(img,group="pnt")
Alternatively you can bind the images directly in in theadd* call,however, this will not include the images when the map is saved usingmapshot orsaveWidget. This options is basically available forbackward compatibility only.
leaflet() %>% addTiles() %>% addCircleMarkers(data=pnt,popup= popupImage(img,src="remote"))
library(sf)library(leaflet)library(lattice)pnt= st_as_sf(data.frame(x=174.764474,y=-36.877245),coords= c("x","y"),crs=4326)p2= levelplot(t(volcano),col.regions= terrain.colors(100))leaflet() %>% addTiles() %>% addCircleMarkers(data=pnt,group="pnt") %>% addPopupGraphs(list(p2),group="pnt",width=300,height=400)
Alternatively you can bind the graphs directly in in theadd* call,however, this will not include the graphs when the map is saved usingmapshot orsaveWidget. This options is basically available forbackward compatibility only.
leaflet() %>% addTiles() %>% addCircleMarkers(data=pnt,popup= popupGraph(p2,width=300,height=400))
See themapviewdocumentationfor further examples.
Please note that the ‘leafpop’ project is released with aContributorCode ofConduct.By participating in this project you agree to abide by its terms.
About
Include Tables, Images and Graphs in Leaflet Popups
Resources
License
Code of conduct
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Packages0
Uh oh!
There was an error while loading.Please reload this page.
Contributors5
Uh oh!
There was an error while loading.Please reload this page.


