View source: R/layer_helpers.R
get_inset_config | R Documentation |
This is a helper for implementing inset-aware ggplot layers. If the inset
is
missing (NA
) then the default inset configuration is retrieved from the coord.
get_inset_config(inset, coord)
inset |
Inset passed in as a param to the layer |
coord |
Coord object for the plot |
Inset configuration or NULL
# defining a new geom deriving from geom_sf()
GeomCustom <- ggplot2::ggproto("GeomCustom", ggplot2::GeomSf,
draw_panel = function(self, data, panel_params, coord, inset = NA) {
inset <- get_inset_config(inset, coord)
# do something with the inset ...
# note that this example doesn't pass on the remaining geom_sf params but
# in real usage you would probably want to do that
ggplot2::ggproto_parent(ggplot2::GeomSf, self)$draw_panel(data, panel_params, coord)
},
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.