hypo_save: Add metadata to exported plots

View source: R/hypoimg_save.R

hypo_saveR Documentation

Add metadata to exported plots

Description

hypo_save() adds a comment to an exported plot.

Usage

hypo_save(
  filename,
  plot = last_plot(),
  comment = "exported with hypoimg::hypo_save()",
  ...
)

Arguments

filename

File name to create on disk.

plot

Plot to save, defaults to last plot displayed.

comment

string scalar,comment to add to the figure metadata.

...

Other arguments passed on to the ggsave() function.

Details

Sometimes it can be useful to add metadata to an exported plot. A typical situation would be to add the name of the r-script producing the figure. This can potentially save some time when trying to find the original script later in life.

Note: The function assumes a UNIX platform and depends on exiftool to be installed and located within the $PATH.

See https://www.sno.phy.queensu.ca/~phil/exiftool/index.html

See Also

hypo_show_metadata,

Examples

# only works with exiftools installed - commented out for build
# tibble(x = rnorm(20),y= rnorm(20)) %>%
#   ggplot(aes(x,y))+geom_point()
#
# hypo_save('~/Desktop/test_plot.png',comment = 'Created by script test.R')
# hypo_show_metadata('~/Desktop/test_plot.png')


k-hench/hypoimg documentation built on June 2, 2022, 1:49 a.m.