Description Usage Arguments Value Note Author(s) See Also Examples
Creates a single symbol style.
1 2 | styleSingle(col, lwd, alpha, fill, fill.alpha, rad, marker)
singles(col, lwd, alpha, fill, fill.alpha, rad, marker)
|
col |
Color used for lines, i.e. lines itself, borders of polygons and circle borders (points). Color might be given as name, number [0-8] or hexadecimal code. If |
lwd |
Line width in number of pixels – default is |
alpha |
Opacity of a line or border, as numeric value between |
fill |
Fill color used for polygons and circles (points). Color might be given as name, number [0-8] or hexadecimal code. If |
fill.alpha |
Opacity of a polygon or circle area, as numeric value between |
rad |
Radius of circles (points), in number of pixels – default is |
marker |
Color (given like |
A single symbol style object.
There is a known issue with Safari browser: maps with four or more marker layers may cause problems with popups.
Christian Graul
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 | ## Not run:
## point data ##
# prepare data
data(quakes)
dat <- toGeoJSON(data=quakes, dest=tempdir())
# change circle borders
# note: if fill color is not specified, col is also used as fill color
sty <- styleSingle(col=2, lwd=1, alpha=1)
map <- leaflet(data=dat, dest=tempdir(), style=sty)
# change fill color, alpha and radius
sty <- styleSingle(fill="red", fill.alpha=1, rad=2)
map <- leaflet(data=dat, dest=tempdir(), style=sty)
# no border
sty <- styleSingle(col=NA)
map <- leaflet(data=dat, dest=tempdir(), style=sty)
# blank circle area
sty <- styleSingle(fill=NA)
map <- leaflet(data=dat, dest=tempdir(), style=sty)
# simple colored markers
sty <- styleSingle(marker="red") # only color
map <- leaflet(data=dat, dest=tempdir(), style=sty)
# markers with label, color and size
sty <- styleSingle(marker=c("triangle", "#E41A1C", "s"))
map <- leaflet(data=dat, dest=tempdir(), style=sty)
# change all arguments
sty <- styleSingle(col="#d4d4d4", lwd=1, alpha=0.8,
fill="darkred", fill.alpha=0.4, rad=4)
map <- leaflet(data=dat, dest=tempdir(), style=sty)
## line data ##
# prepare data
# (httr package required)
dat <- toGeoJSON(data=system.file(package="leafletR", "files",
"lynx.zip"), name="Lynx telemetry", dest=tempdir())
# style
sty <- styleSingle(col="#bb650b", lwd=3, alpha=0.8)
map <- leaflet(data=dat, dest=tempdir(), style=sty)
## polygon data ##
# prepare data
dat <- system.file(package="leafletR", "files", "park_sk.geojson")
# change borders
# note: if fill color is not specified, col is also used as fill color
sty <- styleSingle(col=3, lwd=2, alpha=1)
map <- leaflet(data=dat, dest=tempdir(), style=sty)
# change fill color and alpha
sty <- styleSingle(fill="darkgreen", fill.alpha=0.8)
map <- leaflet(data=dat, dest=tempdir(), style=sty)
# no border
sty <- styleSingle(col=NA)
map <- leaflet(data=dat, dest=tempdir(), style=sty)
# blank polygon area
sty <- styleSingle(fill=NA)
map <- leaflet(data=dat, dest=tempdir(), style=sty)
# change all arguments
sty <- styleSingle(col="#006400", lwd=5, alpha=0.8,
fill="darkgreen", fill.alpha=0.4)
map <- leaflet(data=dat, dest=tempdir(), style=sty)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.