| geom_ellipse_cm {plothelper} | R Documentation |
Geom Layer for Ellipse with Absolute Size
Description
This layer uses centimeter as unit to draw ellipse so that its size and shape will not be influenced by the coordinate systems (even when a polar system is used).
Usage
geom_ellipse_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)
rcmradius in centimeter.(2)
abit means to what extent radius a of an ellipse is larger than radius b. However, its true meaning is the aspect ratio which is used bygridExtra::ellipseGroband indicates the extent to which y dimension is flattened. So, say, whenab = 2, radius a is larger than b, but it is not exactly 2 times larger.(3)
colorcolor of the the outline.(4)
fillcolor inside the shape.(5)
alphaalpha of color and fill.(6)
sizeline width of the outline.(7)
linetypeline type.(8)
angleangle of rotation from 0 degree and in anti-clockwise direction.(9)
nthe number of points to draw the shape. Note: it must be written inside theaes(...)function.(10)
xx coordinates of middle points.(11)
yy coordinates of middle points.
Examples
library(ggplot2)
dat=data.frame(x=c(1, 3, 5, 7, 9), y=rep(5, 5))
ggplot(dat)+xlim(0, 11)+ylim(1, 9)+
geom_ellipse_cm(aes(x=x, y=y), fill="red", ab=seq(1, 4, length.out=5))
ggplot(dat)+xlim(0, 11)+ylim(1, 9)+
geom_ellipse_cm(aes(x=x, y=y, fill=factor(x)), ab=3, angle=c(0, pi/4, pi/3, pi/2, 0.75*pi))