Create a point geometry (of class geom
) either by specifying
anchor values or by sketching it.
gs_point(anchor = NULL, window = NULL, vertices = 1, ...)
anchor | [ |
---|---|
window | [ |
vertices | [ |
... | [various] |
A geom
.
The argument anchor
indicates how the geom is created:
if anchor
is set, the geom is created parametrically
from the points given in anchor
,
if it is not set either
window
or a default window between 0 and 1 is opened to sketch the
geom.
Other geometry shapes:
gs_line()
,
gs_polygon()
,
gs_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 (aGeom <- gs_point(anchor = coords)) #> geom point #> 1 group | 4 features | 4 points #> crs cartesian #> attributes -- #> tiny map 70 #> ◌ ◎ ◌ ◌ #> ◌ ◌ ◌ ◎ #> ◌ ◌ ◌ ◌ #> 40 ◎ ◌ ◌ ◎ 70 #> 40 # the vertices are plottet relative to the window window <- data.frame(x = c(0, 80), y = c(0, 80)) points <- gs_point(anchor = coords, window = window) visualise(points, linecol = "green") # when a geom is used in 'anchor', its properties are passed on aGeom <- setWindow(x = aGeom, to = window) points <- gs_point(anchor = aGeom) visualise(points) # 2. sketch two points if(dev.interactive()){ points <- gs_point(vertices = 2) visualise(points, linecol = "green", pointsymbol = 5, new = FALSE) }