Learn R Programming

LexisPlotR (version 0.4.0)

lexis_polygon: Plot a polygon inside a Lexis grid Takes an existing Lexis grid and adds a polygon.

Description

Plot a polygon inside a Lexis grid Takes an existing Lexis grid and adds a polygon.

Usage

lexis_polygon(lg, x, y, group = 1, fill = lexisplotr_colours()[4],
  alpha = 0.7)

Arguments

lg,

an existing object originally created with lexis_grid().

x,

vector describing the x coordinates of the polygon. Format: YYYY-MM-DD.

y,

vector describing the y coordinates of the polygon

group,

vector describing the groups of coordinates.

fill

character, fill colour of the polygon.

alpha

numeric, transparency of the fill colour. Default: 0.7.

Details

The function can be used to plot a polygon inside a Lexis grid.

Examples

Run this code
# NOT RUN {
library(LexisPlotR)
lg <- lexis_grid(year_start = 1900, year_end = 1905, age_start = 0, age_end = 5)
lexis_polygon(lg, x = c("1901-06-30", "1904-06-30", "1904-06-30", "1901-06-30"), y = c(2,2,4,4))
# }

Run the code above in your browser using DataLab