Description Usage Arguments Examples
This function adds a geom to the plots contained within the column plot
.
1 |
.data |
Data frame with nested data column |
layer_use |
The ggplot2 geom that you want to add |
... |
Other arguments passed onto the geom specified in |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | eg <- mtcars %>%
group_by(am) %>%
nest('data'=-am)%>%
mutate('colour'=ifelse(am==0,'red','purple'),
'title'=sprintf('AM: %i',am),
'subtitle'=sprintf('Data from %i different models',map_dbl(data,nrow)),
'minlimit'=ifelse(am==0,-1000,-250),
'maxlimit'=map_dbl(data,function(x)max(x$disp)))
out <- eg %>%
ggpipe("data") %>%
gglayer(geom_point,aes(x=disp,y=hp),colour=colour)%>%
gglayer(scale_x_continuous,limits=c(minlimit,maxlimit))%>%
gglayer(labs,title=title)%>%
gglayer(facet_wrap,cyl~.)%>%
ggtheme(theme_bw())
out$plot
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.