#' @title Default Plotting Function
#'
#' @param x
#' @param y
#' @param xlim
#' @param ylim
#' @param ... See \code{\link{par}}
#'
#' @export plot0
#' @export plotEmpty
#'
#' @examples
#' plot0(1:10, rnorm(10))
plot0 <- function(x,y
, axes = c(1,2) # NULL, 1, 2 or c(1,2)
, ...){
plot(x,y
, type="l"
, axes=FALSE
, ...)
graphics::box(fg = gray(0.5))
# Axis
if (!is.null(axes)){
if (1 %in% axes){
if (class(x)[1] %in% c("Date", "POSIXct", "POSIXt")) {
axis.Date(1, x, fg = gray(0.5), col=gray(0.5))
} else {
axis(1, fg = gray(0.5), col=gray(0.5))
}
}
if (2 %in% axes) axis(2, fg = gray(0.5), col=gray(0.5))
}
DrawHLines(c(par("yaxp")[1], par("yaxp")[2]))
}
#' @describeIn plot0 for empty plot
plotEmpty <- function(...){
plot(0,0, axes=FALSE, xlab="", ylab="", col=gray.f(0), ...)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.