Skip to content
Leaflet for R Opacity Controls
Branch: master
Clone or download
Latest commit cc0fcd0 Nov 19, 2018
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
R
inst/lib Initial release Nov 7, 2018
man Initial release Nov 7, 2018
tests
vignettes
.Rbuildignore
.gitignore Add CRAN-RELEASE to ignore Nov 7, 2018
DESCRIPTION Fix DESCRIPTION for CRAN Nov 19, 2018
NAMESPACE Initial release Nov 7, 2018
NEWS Initial release Nov 7, 2018
NEWS.md
README.Rmd Add README Nov 7, 2018
README.md Add README Nov 7, 2018
cran-comments.md Fix DESCRIPTION for CRAN Nov 19, 2018
leaflet.opacity.Rproj

README.md

leaflet.opacity

General

leaflet.opacity extends the leaflet R package with the Leaflet.OpacityControls JavaScript plugin (LizardTech, 2013). It offers control buttons and a slider for adjusting the opacity of a layer.

Installation

You can install the released version of leaflet.opacity from CRAN with:

install.packages("leaflet.opacity")

or the latest version from GitHub with:

devtools::install_github("https://github.com/be-marc/leaflet.opacity", dependencies=TRUE)

Example

library(leaflet)
library(leaflet.opacity)
library(raster)

r <- raster(xmn = -2.8, xmx = -2.79, ymn = 54.04, ymx = 54.05, nrows = 30, ncols = 30)
values(r) <- matrix(1:900, nrow(r), ncol(r), byrow = TRUE)
crs(r) <- CRS("+init=epsg:4326")

leaflet() %>%
    addTiles() %>%
    addRasterImage(r, layerId = "raster") %>%
    addOpacitySlider(layerId = "raster")

Reference

LizardTech (2013). Leaflet.OpacityControls. Retrieved from https://github.com/lizardtechblog/Leaflet.OpacityControls

You can’t perform that action at this time.