xgx_annotate_filenames: Append filenames to bottom of the plot

View source: R/xgx_annotate_filenames.R

xgx_annotate_filenamesR Documentation

Append filenames to bottom of the plot

Description

xgx_annotate_filenames appends file details to the bottom of a plot using the plot caption option. File details to append include the parent directory, the path of the R script which generated the plot, and the path of the plot.

Usage

xgx_annotate_filenames(dirs, hjust = 0.5, color = "black", size = 11)

Arguments

dirs

list containing directories and filenames. It must contain five fields

  1. parent_dir = Parent directory containing the Rscript and the Results folder

  2. rscript_dir = Subdirectory ofparent_dir that contains the Rscript used to generate the figure

  3. rscript_name= Name of the Rscript used to generate the figure

  4. results_dir = Subdirectory ofparent_dir where the figure is stored

  5. filename = Filename

hjust

horizontal justification of the caption

color

font color for caption, default black

size

font size for caption, default 11

Value

None

Examples

dirs <- list(parent_dir = "/your/parent/path/",
             rscript_dir = "./Rscripts/",
             rscript_name = "Example.R",
             results_dir = "./Results/",
             filename = "your_file_name.png")
data <- data.frame(x = 1:1000, y = rnorm(1000))
ggplot2::ggplot(data = data, ggplot2::aes(x = x, y = y)) +
  ggplot2::geom_point() +
  xgx_annotate_filenames(dirs)


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