# NOT RUN {
# polygon glyph
p <- ggplot(data = data.frame(x = 1:4, y = 1:4),
mapping = aes(x = x, y = y)) +
geom_polygon_glyph(polygon_x = list(x_star, x_cross, x_hexagon, x_airplane),
polygon_y = list(y_star, y_cross, y_hexagon, y_airplane),
colour = 'black', fill = 'red')
p
# the coords of each polygons can be achieved by calling function `ggplot_build`
build <- ggplot2::ggplot_build(p)
polygon_x <- build$data[[1]]$polygon_x
polygon_y <- build$data[[1]]$polygon_y
# }
Run the code above in your browser using DataLab