hypo_save() adds a comment to an exported plot.

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

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')