Tag ggplot2 graphics with standard meta-information
The primary ggTag
function embeds a ggplot object within a grid framework. The function allows a user to add titles and meta information to the outer border of a plot along with file path and date-time stamps (which are automatically added upon execution). An existing ggplot title can be moved from the original graphic to the outer framework.
devtools::install_github("andyofsmeg/ggTag")
The main package function ggTag
can simply take a ggplot2 object and will automatically add the appropriate meta-information. Additional information can be supplied as arguments to the function.
library(ggplot2)
library(ggTag)
my_scat <- qplot(Temp, Wind, data = airquality, main = "Less Windy when Warm")
# Let's have a look at this summary of 45 year old airquality data
my_scat
# Now let's tag it
library(ggTag)
ggTag(my_scat,
meta = list(top_left = "Analysis ID 123456", top_right = "Page 1 of 1"),
extractTitle = TRUE)
# Pretend it's pharmaceutical data
pharmaTag(my_scat, protocol = "GSK123456", population = "ITT",
page = 1, pages = 2,
extractTitle = TRUE)