brandPlot: Add a logo to a ggplot object

View source: R/brandPlot.R

brandPlotR Documentation

Add a logo to a ggplot object

Description

Adds an image to a ggplot object. This allows the use of package internal logos associated with Mazama Science and the USFS AirFire group specified with brandStyle and brandName. User provided images can be specified by using brandFilePath.

Usage

brandPlot(
  plot,
  brandStyle = c("logo", "icon"),
  brandName = c("MazamaScience", "USFS", "AirFire"),
  brandFilePath = NULL,
  location = c("topright", "topleft", "bottomright", "bottomleft"),
  size = 0.1
)

Arguments

plot

ggplot object

brandStyle

"logo" or "icon".

brandName

Name of brand: "MazamaScience", "USFS", or "AirFire".

brandFilePath

Path to brand logo or icon. If not NULL, overrides brandStyle and brandName.

location

String indicating the location where the logo should be printed. Options are: "topright", "topleft", "bottomright", or "bottomleft".

size

Brand icon or logo width, in fraction of plot width.

Value

A gTree object, which can be printed with grid.draw().

Examples

library(AirMonitorPlots)

monitor <- AirMonitor::Carmel_Valley
mts_tidy <- monitor_toTidy(monitor)

gg <-
  ggplot_pm25Timeseries(mts_tidy) +
  stat_dailyAQCategory(adjustylim = TRUE)

brandPlot(gg, location = "topright", size = .2)
brandPlot(gg, location = "bottomright", brandName = "USFS")
brandPlot(gg, brandName = "AirFire", location = "topleft", size = .15)


MazamaScience/AirMonitorPlots documentation built on May 8, 2024, 6:16 a.m.