#' plot raw curve and fit curve
#'
#' @param df
#' @param config
#' @param mark
#' @param screen.n
#'
#' @return
#' @export
#'
#' @examples
plot.raw.n.fit <- function(df, config, mark, screen.n) {
# VER 1.3.0
screen(screen.n)
erase.screen()
flush.console()
par(mar = config$margin)
mode <- config$mode
# df <- NULL
# try({
# df <- read.csv(path, skip = skip)
# }, silent = T)
# if (is.null(df)) {
# cat(sprintf(
# 'plot.raw.n.fit() > File access failed @ \n %s', basename(path)
# ))
# return(NULL)
# }
#
fc <- NULL
try({
fc <- fit.curve(df[,2], mode, config)
}, silent = T)
if (is.null(fc)) {
cat(
sprintf(
'plot.raw.n.fit() > fit.curve() > Curve fit failed @ \n %s', basename(path)
)
)
return(NULL)
}
plot(
df[,1], df[,2],
type = 'l',
col = 'blue',
main = mark,
xlab = 'Voltage',
ylab = 'Current'
)
par(new = T)
plot(
df[,1], fc,
type = 'l',
col = 2,
axes = F,
main = '',
xlab = '',
ylab = ''
)
par(new = F)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.