R/f_plot.R

Defines functions f_plot

Documented in f_plot

#' Plot functional data
#'
#' This function plots functional data on a time grid
#'
#' @param t A numeric vector of length \eqn{M} specifying the common grid on
#'   which all curves `f` have been observed.
#' @param f A numeric matrix of shape \eqn{M \times N} specifying a sample of
#'   \eqn{N} curves observed on a grid of size \eqn{M}.
#'
#' @importFrom graphics plot
#' @export
f_plot <- function(t, f){

  colors = c(
    "#66C2A5",
    "#FC8D62",
    "#8DA0CB",
    "#E78AC3",
    "#A6D854",
    "#FFD92F",
    "#E5C494",
    "#B3B3B3"
  )

  M <- nrow(f)

  graphics::matplot(
    x = t,
    y = f,
    type = "l",
    col = colors,
    main = "Original Data",
    xlab = "Time",
    ylab = "Amplitude"
  )
}

Try the fdasrvf package in your browser

Any scripts or data that you put into this service are public.

fdasrvf documentation built on Oct. 5, 2024, 1:08 a.m.