| geom_rect_cm {plothelper} | R Documentation |
Geom Layer for Rectangle with Absolute Size
Description
This layer uses centimeter as unit to draw rectangles so that the size and shape will not be influenced by the coordinate systems (even when a polar system is used).
Usage
geom_rect_cm(
mapping = NULL,
data = NULL,
stat = "identity",
position = "identity",
na.rm = FALSE,
show.legend = NA,
inherit.aes = TRUE,
...
)
Arguments
mapping |
aes mapping. |
data |
data. |
stat |
stat. |
position |
position. |
na.rm |
logical, whether to remove NA values. |
show.legend |
whether to show legend. |
inherit.aes |
logical, whether to inherit aes from ggplot(). |
... |
additional parameters. |
Details
Accepted properties are:
(1)
widthwidth in centimeter.(2)
heightheight in centimeter.(3)
colorcolor of the outline.(4)
fillcolor inside the shape.(5)
alphaalpha of color and fill.(6)
sizeline width of outline.(7)
linetypeline type.(8)
hjusthorizontal adjustment, default is 0.5 which means no adjustment.(9)
vjustvertical adjustment, default is 0.5 which means no adjustment.(10)
xx coordinates of middle points.(11)
yy coordinates of middle points.
Examples
library(ggplot2)
ggplot()+xlim(-0.5, 10.5)+
geom_rect_cm(aes(x=1: 10, y=rep(4, 10)), fill="red", height=rep(1: 2, each=5),
vjust=rep(c(0, 0.5), 5))+
geom_point(aes(x=1: 10, y=rep(4, 10)), color="green")