autoplot() (from ggplot2) for a pic() object: georeferences the
drawing with rpic_sf() and draws it with rpic_layers() — fills,
strokes and labels as pic drew and placed them — on a blank theme. The
result is an ordinary ggplot: add scales, a theme or more layers with
+ (a layer added this way goes on top of the drawing; for a basemap
under it, build the plot from rpic_layers() directly, as
vignette("maps") does).
Arguments
- object
a
pic()object whose source georeferences itself (geo_lon/geo_lat, control points) or is givenanchor/featuresin....- ...
passed to
rpic_sf()(anchor,scale,bearing,frame,features, ...).- linewidth
line width of the shapes, in
ggplot2units (mm).NULLdraws each shape at pic's own width (thestroke_widthcolumn, points, 0.8 by default).- text_size
size of the labels, in
ggplot2units (mm).
Examples
if (requireNamespace("ggplot2", quietly = TRUE) &&
requireNamespace("sf", quietly = TRUE)) {
p <- pic('geo_lon = -34.8711; geo_lat = -8.0631; geo_scale = 1000
C: circle rad 2 at (0, 0) dashed fill 0.97
dot at C.c rad 0.04
"2 km" above at 0.5 <C.c, C.e>')
ggplot2::autoplot(p)
}