diff --git a/R/inspect-model.R b/R/inspect-model.R index a9f86a9..1b2a182 100644 --- a/R/inspect-model.R +++ b/R/inspect-model.R @@ -96,7 +96,9 @@ inspect_model <- function(mod, private) { prior_code(input) }) output$prior_predicted <- plotly::renderPlotly({ - plotly::ggplotly(plot(prior())) + plotly::style(plotly::ggplotly(plot(prior(), + upper_censoring_limit = private$stan_input_data$upper_censoring_limit, + lower_censoring_limit = private$stan_input_data$lower_censoring_limit)), textposition = "right") }) # model inputs @@ -135,13 +137,17 @@ inspect_model <- function(mod, private) { if (is.null(selected) || selected == "None") { selected <- character(0) } - plot_sero_data(data(), ncol = cols(), covariates = selected) + + plot_sero_data(data(), + ncol = cols(), + covariates = selected, + upper_censoring_limit = private$stan_input_data$upper_censoring_limit, + lower_censoring_limit = private$stan_input_data$lower_censoring_limit) + theme(plot.margin = unit(c(1, 0, 0, 0), "cm")) }) output$data <- plotly::renderPlotly({ if (nrow(data()) > 0) { - gp <- plotly::ggplotly(plot_inputs()) + gp <- plotly::style(plotly::ggplotly(plot_inputs()), textposition="right") if (selected_covariate() != "None") { return(facet_strip_bigger(gp, 30)) } else { diff --git a/R/plot.R b/R/plot.R index c8b3d18..dcd788c 100644 --- a/R/plot.R +++ b/R/plot.R @@ -56,10 +56,8 @@ plot.biokinetics_priors <- function(x, geom_point(data = dat, size = 0.5, aes(x = time_since_last_exp, y = value)) - - plot <- add_limits(plot, upper_censoring_limit, lower_censoring_limit) } - plot + add_limits(plot, upper_censoring_limit, lower_censoring_limit) } #' @title Plot serological data @@ -157,7 +155,7 @@ add_limits <- function(plot, upper_censoring_limit, lower_censoring_limit) { linetype = 'dotted') + annotate("text", x = 1, y = lower_censoring_limit, - label = "Lower detection limit", + label = "Lower censoring limit", vjust = -0.5, hjust = 0, size = 3) @@ -168,7 +166,7 @@ add_limits <- function(plot, upper_censoring_limit, lower_censoring_limit) { linetype = 'dotted') + annotate("text", x = 1, y = upper_censoring_limit, - label = "Upper detection limit", + label = "Upper censoring limit", vjust = -0.5, hjust = 0, size = 3)