Draws closed shapes from x/y vertices. Rows that share a
value of group are the vertices of one polygon, joined in row order,
and the last vertex is joined back to the first. Without a group
mapping, all rows form one polygon. Mapping color fills each polygon by
its value; a polygon whose rows have different colours is split into one
polygon per colour.
Each polygon is one element: its tooltip shows the polygon rather than a
single vertex, and brushing or clicking it selects all of its rows. A
tooltip template can use any column that has the same value on every row
of the polygon, such as a name or an id. Rows with a missing x or y
are dropped first, with a warning, and polygons left with fewer than
three vertices are not drawn.
Usage
mark_polygon(spec, ..., data = NULL, style = list(), radius = 0)Arguments
- spec
A glyph_spec
- ...
Aesthetic mappings:
xandy(required, numeric),groupandcolor.- data
Optional per-mark data override
- style
Named list of fixed visual properties:
fill(a colour used whencolorisn't mapped),stroke(outline colour, the theme's foreground colour by default),stroke_width(in pixels, 0 for no outline) andopacity(of the fill).- radius
Radius of rounded corners, in pixels. Each corner is rounded by at most half the length of its shorter edge. 0 (the default) keeps sharp corners.