R/.plot_residuals_interactive.R

Defines functions plot_residuals_interactive

# plot_residuals_interactive ---------------------------------------------------
plot_residuals_interactive <- function(prediction_df, binwidth = NULL)
{
  get_residuals <- function(df) {
    data.frame(residuals = df$simulated - df$observed)
  }

  g <- get_residuals(df = prediction_df) %>%
    ggplot2::ggplot(ggplot2::aes_string(x = "residuals")) +
    ggplot2::geom_histogram(binwidth = binwidth) +
    ggplot2::theme_bw()

  plotly::ggplotly(g)
}
KWB-R/kwb.heatsine documentation built on Oct. 22, 2020, 12:37 a.m.