Description Usage Arguments Value Examples
modify plots by hiding x/y axes if shared x/y axis is used, plots combination
is done by patchwork
package.
plotlist can also be output by setting return.plots = TRUE
.
1 2 3 4 5 6 7 8 9 10 11 12 13 |
... |
ggplot objects |
shared.axis |
'x', 'y', defaults to 'y' |
plots.theme |
ggplot theme, defaults to |
plots.coord |
ggplot coord, defaults to |
title |
str, plot global title |
subtitle |
str, plot global subtitle |
caption |
str, plot global caption |
nrow |
int, number of rows of the layout |
ncol |
int, number of ncols of the layout |
legend.position |
'right','left','bottom','top' |
return.plots |
if TRUE -> return list of plots only, defaults to FALSE |
ggplot
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | library(ggplot2)
library(dplyr)
library(patchwork)
p1 <- mtcars %>%
mutate(gear = factor(gear), am = factor(am)) %>%
util.plot.stack.bar('gear','am') +
labs(title = 'p1')
p2 <- mtcars %>%
mutate(am = factor(gear)) %>%
group_by(am) %>%
summarise(n = n()) %>%
ggplot(aes(x = am, y = n)) +
geom_bar(stat = 'identity', fill = util.lh2.fill('orange'))+
labs(title = 'p2')
util.plots.share.axis(p1, p2,
title = 'Shared Axis Plot')
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.