ggstamp {tracee}R Documentation

Always stamp your plots with script name

Description

This function is used to stamp ggplot type plots with datetime and script name. User must provide the script name.

Usage

ggstamp(plot, script = "", file, time = Sys.time())

Arguments

plot

The plot to be stamped.

script

the script name. Date and time will be added automatically.

file

An optional output filename to be included in the stamp.

time

The timestamp to be included.

Details

The stamp is adding using the caption label. If a caption is already in the plot, the stamp will be added in a new line.

The caption is derived as caption=paste(c(plot$label$caption,stamp,paste(date.txt,file)),collapse="\n")

ggplot 2.2.1 (which is years old) or newer is required.

Value

the plot with a stamp

A plot object with the stamp added as caption

See Also

Other Plotting: canvasSize(), ggwater(), ggwrite()

Examples

library(ggplot2)
data(ChickWeight)
p1 <- ggplot(ChickWeight,aes(Time,weight,group=Chick,colour=factor(Diet)))+geom_line()
script <- "note"
ggstamp(p1,script)
## Or use ggwrite which will call ggstamp when the `script` argument is provided.
ggwrite(p1,script=script,canvas="wide")

[Package tracee version 0.0.4 Index]