xgx_annotate_status_png: Annotate a png file or directory of png files

View source: R/xgx_annotate_status_png.R

xgx_annotate_status_pngR Documentation

Annotate a png file or directory of png files

Description

These function annotates a single png file or all files within a directory.

Usage

xgx_annotate_status_png(
  file_or_dir,
  script = "",
  status = "DRAFT",
  date_format = "%a %b %d %X %Y",
  col = grDevices::grey(0.8, alpha = 0.7),
  font = 2,
  cex_status_mult = 7,
  cex_footnote_mult = 0.8,
  status_angle = 45,
  x11 = FALSE
)

Arguments

file_or_dir

The png file to annotate or directory location for annotating png files. Note this will annotate just once, so if you generate multiple png files and then annotate at the end of your script it will have the correct script name on it. Then if you create new images in a different script in the same directory and then annotate with the script name the second script, the PNG files will show the correct script location for each file.

script

Script name to add as a footnote; By default this is empty, though it could name the script that

status

Draft or other status; If status="Final" or status="" the status overlay will be removed. By default the status is DRAFT.

date_format

Date format for adding the time the png was annotated.

col

Color for annotating the draft status

font

Font to use for the annotation function

cex_status_mult

Multiplication factor for the status annotation. By default 7

cex_footnote_mult

Multiplication factor for the footnote annotation. By default 0.8

status_angle

Angle to rotate status

x11

Display on the X11/Windows device

Details

If a png file has been annotated once, this function will not annotate it again. Therefore, you can run this function on directories with different input script names and it will label each file based on when each file was run.

Based on code from MrFlick on Stack Overflow.

Value

nothing

Author(s)

Matthew Fidler, Alison M, ....

Examples

# using the examples from plot()
file.name <- tempfile()
grDevices::png(file.name)
graphics::plot(cars)
graphics::lines(stats::lowess(cars))
grDevices::dev.off()
# annotate one file
xgx_annotate_status_png(file.name, "/tmp/script1.R")


xgxr documentation built on March 31, 2023, 11:46 p.m.