plot.sf | R Documentation |
Overrides 'sf::plot.sf' and wraps the call to 'plot(st_geometry(x))'. When working with spatial data it's often useful to create maps where we overlay spatially coincident data in a plot.
## S3 method for class 'sf' plot(x, ...)
x |
sf object (the data.frame one) |
... |
arguments passed to [sf::plot_sfc] |
This is used so that plots aren't always facetted by all attributes, coloured by them, or leaving the plot unusable for subsequent additional drawing. The key feature is that we don't have to change our behaviour and good habits depending on the format in use.
used for its side effects of creating a plot
x <- read_sf(system.file("shape/nc.shp", package="sf")) ## all we've changed is the plot command plot(x) ## we can overplot without format-specific acrobatics plot(x[sample(1:nrow(x), 10), ], col = rainbow(10), add = TRUE) abline(v = 34); axis(2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.