Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Include Tables, Images and Graphs in Leaflet Popups

License

NotificationsYou must be signed in to change notification settings

r-spatial/leafpop

Repository files navigation

cran checksTravis build statusmonthlytotalCRANstatus

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’.

Installation

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")

Examples

popupTable

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

addPopupImages & popupImage

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"))

popupGraph

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))

Further examples

See themapviewdocumentationfor further examples.

Code of Conduct

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

Stars

Watchers

Forks

Packages

No packages published

Contributors5


[8]ページ先頭

©2009-2025 Movatter.jp