Description Usage Arguments Value Examples
gives the opportunity for subplots. it has nothing to do with ggplot exept of the fact, that it is build for ggplots. It is taken from R-Cookbook.
1 |
... |
end of list of ggplots |
plotlist |
end of list of ggplots |
cols |
count of columns |
layout |
matrix for the layout with indices of the plots |
subplots
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | hlpr4life::load.pkgs(c("hlpr4life","ggplot2","dplyr"))
(d<-data.frame(x=rnorm(1000,10),y=sample(letters[1:3],1000,T),s=sample(c("female","male"),1000,T)))
m<-summarise(group_by(d,y,s),m=mean(x))
ggsubplot(
ggplot( d ) + theme_bw( ) + scale_color_discrete( guide = F ) +
geom_point( aes( c( 1 : 1000 ), x, col = paste0( y, s ) ) ),
ggplot( d ) +
theme_bw( ) + scale_fill_discrete( guide = F ) + scale_color_discrete( guide = F ) +
geom_histogram( aes( x, fill = paste0( y, s ) ), alpha = .5 ) +
geom_vline( aes( xintercept = m, col = paste0( y, s ) ), m ) +
facet_grid( s ~ y ),
ggplot( d ) +
theme_bw( ) + scale_fill_discrete( guide = F ) + scale_color_discrete( guide = F ) +
geom_histogram( aes( x, fill = paste0( y, s ) ), alpha = .5 ) +
geom_vline( aes( xintercept = m, col = paste0( y, s ) ), m ),
layout = t(
matrix(
c(
1, 2,
3, 3 ),
ncol = 2 ) ) )
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.