geo_point | R Documentation |
geom
Create a point geometry (of class geom
) either programatically
by specifying coordinate values, by sketching it or by casting to it from
another geom type.
geo_point(crds = NULL, window = NULL, vertices = 1)
as_point(geom)
crds |
data.frame(2) |
window |
data.frame(2) |
vertices |
integerish(1) |
geom |
gridded(1) |
A point geom.
Other geometry shapes:
geo_line()
,
geo_polygon()
,
geo_random()
# 1. create points programmatically
coords <- data.frame(x = c(40, 70, 70, 50),
y = c(40, 40, 60, 70))
# if no window is set, the bounding box will be set as window ...
(pointGeom <- geo_point(crds = coords))
# ... otherwise the vertices are plotted relative to the window
window <- data.frame(x = c(0, 80),
y = c(0, 80))
points <- geo_point(crds = coords, window = window)
geo_vis(points, linecol = "#FFB000")
# 2. cast to point geom from another type
pointGeom <- as_point(geom = gtGeoms$polygon)
geo_vis(gtGeoms$polygon, linecol = "#FFB000", theme = setTheme(box = list(fillcol = "#282828")))
geo_vis(pointGeom, linecol = "#33FF00", pointsymbol = 5, new = FALSE)
# 3. sketch two points
if(dev.interactive()){
points <- geo_point(vertices = 2)
geo_vis(points, linecol = "#B24223", pointsymbol = 22, new = FALSE)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.