Description Usage Arguments Value Author(s) Examples
View source: R/position_stackx.R
Stack overlapping objects which can be shifted vertically or horizontally
1 | position_stackx(vjust = 1, hexpand = NA, vexpand = NA, reverse = FALSE)
|
vjust |
Vertical adjustment for geoms that have a position
(like points or lines), not a dimension (like bars or areas). Set to
|
hexpand |
numeric, distance to be shifted horizontally for geoms that have a position, default is NA. |
vexpand |
numeric, distance to be shifted vertically for geoms that have a position, default is NA. |
reverse |
If |
position method.
Shuangbin Xu
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | library(ggplot2)
library(patchwork)
df <- data.frame(trt = c("a", "b", "c"), outcome = c(2.3, 1.9, 3.2))
#
p1 <- ggplot(df, aes(x=trt, y=outcome)) +
geom_bar(stat="identity",
position=position_stackx())
p2 <- ggplot(df, aes(x=trt, y=outcome)) +
geom_bar(stat="identity",
position=position_stackx(vexpand=5))
p3 <- ggplot(df, aes(x=outcome, y=trt)) +
geom_bar(stat="identity",
orientation="y",
position=position_stackx(hexpand=5))
p <- p1 + p2 + p3
p
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.