View source: R/geom-polygon-glyph.R
geom_polygon_glyph | R Documentation |
Each point glyph can be a polygon object.
We provide some common polygon coords in polygon_glyph
. Also, users can
customize their own polygons.
geom_polygon_glyph(
mapping = NULL,
data = NULL,
stat = "identity",
position = "identity",
...,
polygon_x,
polygon_y,
linewidth = 1,
na.rm = FALSE,
show.legend = NA,
inherit.aes = TRUE
)
mapping |
Set of aesthetic mappings created by |
data |
The data to be displayed in this layer. There are three options: If A A |
stat |
The statistical transformation to use on the data for this
layer, either as a |
position |
Position adjustment, either as a string naming the adjustment
(e.g. |
... |
Other arguments passed on to |
polygon_x |
nested list of x-coordinates of polygons, one list element for each scatterplot point.
If not provided, a point visual ( |
polygon_y |
nested list of y-coordinates of polygons, one list element for each scatterplot point.
If not provided, a point visual ( |
linewidth |
line width of the "glyph" object |
na.rm |
If |
show.legend |
logical. Should this layer be included in the legends?
|
inherit.aes |
If |
a geom
layer
geom_..._glyph() understands the following aesthetics (required aesthetics are in bold):
x
y
alpha
colour
fill
group
size
linetype
shape
stroke
The size unit is cm
Note that the shape and stroke do not have real meanings unless the essential
argument polygon_x
or polygon_y
is missing.
If so, a point visual will be displayed with corresponding shape and stroke.
geom_serialaxes_glyph
, geom_image_glyph
# 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
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.