geom
sSketch geom
s by clicking into a plot.
gt_sketch(
template = NULL,
shape = NULL,
features = 1,
vertices = NULL,
regular = FALSE,
fixed = FALSE,
show = FALSE,
...
)
[RasterLayer(1)
| matrix(1)
] Gridded object
that serves as template to sketch the geometry.
[character(1)
] a geometry shape that should be
sketched, possible are the geom types "point"
, "line"
and
"polygon"
and special cases thereof (recently implemented are
"triangle"
, "square"
, "hexagon"
) and "random"
.
[integerish(1)
] number of geometries to create.
[integerish(.)
] number of vertices per geometry;
will be recycled if it does not have as many elements as specified in
features
.
[logical(1)
] if a polygon is sketched, should it be
regular, i.e. point symmetric (TRUE
) with the number of corners
defined by vertices
or should the vertices be selected according to
the click locations, resulting in a non-regular polygon (FALSE
,
default)?
[logical(1)
] if a regular polygon is sketched, should
it be aligned vertically (TRUE
, default), or should it be aligned
according to the second click (FALSE
); only relevant if
regular = TRUE
.
[logical(1)
] should plot information be shown in the
plot (TRUE
), or should the geom merely be returned in the console
(FALSE, default
)
[various] additional arguments to gt_locate
.
An invisible geom
.
Other geometry tools:
gt_reflect()
,
gt_rotate()
,
gt_scale()
,
gt_skew()
,
gt_stretch()
,
gt_translate()
# NOT RUN {
# sketch a point geometry
gt_sketch(template = gtRasters$categorical, shape = "point") %>%
visualise(points = ., linecol = "green", pointsymbol = 5, new = FALSE)
# sketch a line geometry
gt_sketch(template = gtRasters$categorical, vertices = 4, shape = "line") %>%
visualise(points = ., linecol = "orange", linewidth = 5, new = FALSE)
# sketch a polygon geometry
gt_sketch(template = gtRasters$continuous, shape = "hexagon") %>%
visualise(geom = ., linecol = "deeppink", linetype = 2, new = FALSE)
# }
Run the code above in your browser using DataLab