#' Plot Data Generated by mcguiR::ROC_value()
#'
#' @param ROC_data data frame generated by ROC_value()
#' @param title character vector containing preferred title (If left empty, blank)
#' @param method method for geom_smooth to use ("lm", "glm", "gam", "loess") - "loess" is default
#' @return plot with FPR on the x axis and TPR on the y axis
#' @export
#'
#' @examples
#' \dontrun{
#' iris2 <- iris[stringr::str_detect(Species, "setosa", negate = T), ]
#' irismodel <- glm(Species ~ ., data = iris2, family = binomial)
#' roc_value <- ROC_value(irismodel, iris2, iris2$Species, "virginica",
#' "versicolor")
#' ROC_plot(roc_value, title = "This Plot ROCs")}
ROC_plot <- function(ROC_data, method = "loess", title = "") {
ggplot2::ggplot(ROC_data, ggplot2::aes(y = TPR, x = FPR)) +
ggplot2::geom_point(size = 0.3, alpha = 0.5, color = "#9E0142") +
ggplot2::geom_smooth(formula = y ~ x, method = method, color = "#3288BD") +
ggplot2::labs(title = title) +
ggplot2::geom_abline(slope = 1, color = "#9E0142") +
ggplot2::ylim(0, 1) +
ggplot2::xlim(0, 1)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.