| zoom | R Documentation |
Provides crop_to() to zoom in to a subset of a data frame, and view_box()
to annotate the zoomed-in region on the full plot.
crop_to(subset, data, ...)
view_box(subset, data)
subset |
An indexing expression to select rows from |
data |
An |
... |
Additional arguments passed to |
crop_to() returns a coord_sf() object to be added to a ggplot.
view_box() returns a geom_rect() layer to be added to a ggplot.
library(ggplot2)
data(oregon)
ggplot(oregon, aes(fill = ndv / (ndv + nrv))) +
geom_sf(size = 0) +
scale_fill_538(name = "") +
view_box(county == "Multnomah", oregon) +
theme_map()
ggplot(oregon, aes(fill = ndv / (ndv + nrv))) +
geom_sf(size = 0) +
scale_fill_538(name = "") +
crop_to(county == "Multnomah", oregon) +
theme_map()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.