R/fPlot_Line_Single.R

Defines functions fPlot_Line_Single

Documented in fPlot_Line_Single

#' This simple ggplot function takes the name of an x-axis column and a y-axis column and plots a line chart. Function is primarily used to create composite charts while keeping the theme choices consistent.


#' @export
#' @title Simple line chart for continuous data time series
#' @param dat a dataframe containing your 'x' and 'y' variables of interest
#' @param xcol a character object specifying the column name of the x-axis variable
#' @param ycol a character object specifying the column name of the x-axis variable
#' @importFrom ggplot2 ggplot aes geom_line theme element_text element_blank element_line


## fPlot_Line_Single was written to be a simple ggplot function while creating composite plots
# Plots y ~ x using a line chart
fPlot_Line_Single <- function(dat, xcol, ycol) {

  p <- ggplot(dat, aes(x = .data[[xcol]], y = .data[[ycol]])) +
    geom_line(alpha=0.4) +
    theme(
      plot.title = element_text(color="black", hjust = 0.5, size=13, face="bold"),
      plot.subtitle = element_text(color="black", hjust = 0.5, size=11, face="bold"),
      axis.line = element_line(size=0.75),
      axis.title.x = element_blank(),
      axis.text.x = element_text(size=12,color="black"),
      axis.title.y = element_text(size=12,color="black"),
      axis.text.y = element_text(size=12,color="black"),
      panel.background = element_blank()
    )

  return(p)

}
ksmiff33/FluxSynthU documentation built on Dec. 15, 2020, 10:29 p.m.