brand_plot: Add logo and source information in footer

Description Usage Arguments Examples

View source: R/brand_plot.R

Description

Uses plot_grid() from the cowplot package to brand plots with the logo (right-justified) and has an option to add information about the data source (left-justified) in the same plot footer element.

Usage

1
brand_plot(plot, add_source = FALSE, source_text = "Made with {wwplot}")

Arguments

plot

A ggplot object

add_source

logical. If TRUE, then you must supply text using the source_text arg (throws error otherwise), which is pasted after "Source:" in the output plot.

source_text

Text to be combined with "Source:" and printed in plot footer.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
library(ggplot2)

p <- ggplot(iris, aes(x = Species, y = Sepal.Length)) +
    geom_boxplot(fill = wwfc_cols("light gold 20")) +
    wolves_theme() +
    theme(axis.title.y = element_blank()) +
    labs(title = "Virginica sepals are the longest",
         subtitle = "Sepal length (mm) by species")

# add logo to plot
brand_plot(p)

# add logo and data source information to plot
brand_plot(p, add_source = TRUE, source_text = "Iris dataset")

lizardburns/wwplot documentation built on Jan. 5, 2022, 12:26 a.m.