Skip to content
Snippets Groups Projects
Commit 8136521a authored by Arnaud Duvermy's avatar Arnaud Duvermy
Browse files

density to histogram

parent 78bb8521
No related branches found
No related tags found
No related merge requests found
...@@ -40,10 +40,10 @@ subset_glance <- function(glance_df, focus){ ...@@ -40,10 +40,10 @@ subset_glance <- function(glance_df, focus){
#' values include "AIC", "BIC", "logLik", "deviance", "df.resid", and #' values include "AIC", "BIC", "logLik", "deviance", "df.resid", and
#' "dispersion". If \code{NULL}, all available metrics will be plotted. #' "dispersion". If \code{NULL}, all available metrics will be plotted.
#' #'
#' @return A ggplot object displaying density plots for the specified metrics. #' @return A ggplot object displaying histogram plots for the specified metrics.
#' #'
#' @importFrom reshape2 melt #' @importFrom reshape2 melt
#' @importFrom ggplot2 aes facet_wrap geom_density theme_bw theme ggtitle #' @importFrom ggplot2 aes facet_wrap geom_histogram theme_bw theme ggtitle
#' #'
#' @export #' @export
#' #'
...@@ -59,7 +59,7 @@ metrics_plot <- function(l_tmb, focus = NULL) { ...@@ -59,7 +59,7 @@ metrics_plot <- function(l_tmb, focus = NULL) {
} }
long_glance_df <- reshape2::melt(glance_df, variable.name = "metric") long_glance_df <- reshape2::melt(glance_df, variable.name = "metric")
p <- ggplot2::ggplot(long_glance_df) + p <- ggplot2::ggplot(long_glance_df) +
ggplot2::geom_density(ggplot2::aes(x = value, col = metric, fill = metric), alpha = 0.4) + ggplot2::geom_histogram(ggplot2::aes(x = value, col = metric, fill = metric)) +
ggplot2::facet_wrap(~metric, scales = "free") + ggplot2::facet_wrap(~metric, scales = "free") +
ggplot2::theme_bw() + ggplot2::theme_bw() +
ggplot2::theme(legend.position = 'null') + ggplot2::theme(legend.position = 'null') +
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment