geom_polypath function

Polygons with holes in ggplot2

Polygons with holes in ggplot2

This geometry used to plot polygons with holes in ggplot2 at the more correctly than geom_polygon ; however, in recent R and ggplot2 versions this is no longer needed.

geom_polypath( mapping = NULL, data = NULL, stat = "identity", position = "identity", na.rm = FALSE, show.legend = NA, inherit.aes = TRUE, rule = "winding", ... )

Arguments

  • mapping: An aesthetic mapping, created with aes . The aesthetic will mostly likely need to contain a group mapping.
  • data: A data.frame containing the coordinates to plot.
  • stat: A statistic to apply (most likely "identity")
  • position: A position to apply (most likely "identity")
  • na.rm: Should missing coordinate be removed?
  • show.legend: Should a legend be shown for mapped aesthetics?
  • inherit.aes: Should aesthetics be inherited?
  • rule: A fill rule to apply. One of "winding" or "evenodd".
  • ...: Passed to the geom and/or stat.

Returns

A ggplot2 layer

Examples

library(ggplot2) load_longlake_data(which = "longlake_waterdf") ggplot(df_spatial(longlake_waterdf), aes(x, y, group = piece_id)) + geom_polypath()