View source: R/decorate_plot.r
decorate_plot | R Documentation |
Decorate a ggplot with title, subtitle, footer reference text and full-page background image. This makes use of the cowplot package to strip apart the basic ggplot object and recombine it into a presentation-ready image.
decorate_plot(
plot,
title = NULL,
subtitle = "http://www.weirddatascience.net | @WeirdDataSci",
footer = NULL,
title_colour = "#3c3f4a",
subtitle_colour = title_colour,
footer_colour = title_colour,
bg_colour = NULL,
bg_image = NULL,
decorate_theme = NULL,
rel_heights = c(0.1, 1, 0.05)
)
plot |
ggplot plot object to centralize. |
title |
Title text for the plot. |
subtitle |
Subtitle text for the plot. |
footer |
Footer text, for references and acknowledgements. |
title_colour |
Colour for the plot title. |
subtitle_colour |
Colour for the plot subtitle. Defaults to the same as the title. |
footer_colour |
Colour for the plot footer. Defaults to the same as the title. |
bg_colour |
Background colour for the plot. If given, this will override the main plot's background by setting it to be transparent, and cause this colour to span the entire plot without borders. Note that this argument will override any |
bg_image |
Path to a background image for the page. This will span the entire plot without borders. |
rel_heights |
Array of relative heights for the title, plot, and footer sections. Defaults to c(0.1, 1, 0.05). |
theme |
A theme object to use in constructing the titles and footer. |
df <- data.frame( x=rnorm(100), y=rnorm(100) )
gp <- ggplot( df, aes(x=x, y=y) ) + geom_point()
dp <- decorate_plot( gp, "Plot Title", "Weird Data Science", "Data: Normal Distribution" )
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.