#' Plot method for mfsd.fd objects
#'
#' @param x object of class mfsd.fd
#' @param xlim limits of x axis
#' @param ylim limits of y axis
#' @param main title
#' @param xlab x label
#' @param ylab y label
#' @param gridsize grid size
#' @param set.dims dimension selection
#' @param ... additional graphical parameters
#' @return
#' No return value. This function is called for its side effect of
#' producing graphical plots of the functional spatial data.
#'
#' @method plot mfsd.fd
#' @export



plot.mfsd.fd <- function(x, xlim = NULL, ylim = NULL, main = NULL,
                         xlab = NULL, ylab = NULL,
                         gridsize = NULL, set.dims = NULL, ...) {

  object <- x

  y <- length(object)

  oldpar <- par(no.readonly = TRUE)
  on.exit(par(oldpar))

  for (i in 1:y) {
    if (!inherits(object[[i]], "fd")) {
      stop("'object' is not a functional data type.")
    }

    fd_mfsd = vector("list", y)
    oldClass(fd_mfsd ) <- ("fd_mfsd")



  }

  par(mfrow = c(1, y))

  for (i in 1:y) {
    fsd.plot.data(object[[i]], basisobj = NULL, gridsize = gridsize, set.dims = set.dims,
                  xlim = xlim, ylim = ylim, main = main,
                  xlab = xlab, ylab = ylab)
  }
}
