Skip to content

Commit

Permalink
make compareEstimates() return ggplot object
Browse files Browse the repository at this point in the history
  • Loading branch information
richardli committed Aug 14, 2024
1 parent ef4654b commit 2d4509a
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion R/smoothArea.R
Original file line number Diff line number Diff line change
Expand Up @@ -427,6 +427,7 @@ plot.svysae <- function(x, return_list = F, plot.factor = NULL, ...) {
#' @param x an object in the S3 class of svysae, fhModel, or clusterModel. Plots are created for all models in this object.
#' @param posterior.sample Matrix of posteriors samples of area level quantities with one row for each area and one column for each sample. This argument may be specified to only provide a heatmap for the desired samples.
#' @param title Optional parameter changing the title of the plot
#' @param return.plot Logical indicator for whether the ggplot object is returned
#'
#' @return ggplot containing heat map of pairwise comparisons
#'
Expand Down Expand Up @@ -454,7 +455,8 @@ plot.svysae <- function(x, return_list = F, plot.factor = NULL, ...) {
#' }
compareEstimates <- function(x,
posterior.sample = NULL,
title = NULL) {
title = NULL,
return.plot = FALSE) {


x_att <- attributes(x)
Expand Down Expand Up @@ -545,6 +547,7 @@ compareEstimates <- function(x,
} else if (is.null(posterior.sample)) {
g_heat <- g_heat + ggplot2::labs(title = x_att$inla.fitted[i])
}
if(return.plot) return(g_heat)
suppressWarnings(print(g_heat))
}
}
Expand Down

0 comments on commit 2d4509a

Please sign in to comment.