Skip to content

Commit

Permalink
fix plot test
Browse files Browse the repository at this point in the history
  • Loading branch information
hillalex committed Oct 23, 2024
1 parent d137fb2 commit b3c8bd8
Show file tree
Hide file tree
Showing 3 changed files with 712 additions and 4 deletions.
12 changes: 8 additions & 4 deletions R/plot.R
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,13 @@ plot_data <- function(data, covariates) {
#' a data.table containing raw data as provided to the biokinetics model.
#' @export
plot.biokinetics_population_trajectories <- function(x, ...) {
covariates <- attr(x, "covariates")
if (!attr(x, "summarised")) {
by <- setdiff(colnames(x), c("t0_pop", "tp_pop", "ts_pop",
"m1_pop", "m2_pop", "m3_pop",
".draw", "mu"))
"m1_pop", "m2_pop", "m3_pop",
"beta_t0", "beta_tp", "beta_ts",
"beta_m1", "beta_m2", "beta_m3",
".draw", "mu"))
x <- summarise_draws(
x, column_name = "mu", by = by)
}
Expand All @@ -101,8 +104,9 @@ plot.biokinetics_population_trajectories <- function(x, ...) {
aes(x = as.integer(day - last_exp_day, units = "days"),
y = value), size = 0.5, alpha = 0.5)
}
plot + scale_y_continuous(trans = "log2") +
facet_wrap(eval(parse(text = facet_formula(attr(x, "covariates"))))) +
plot +
scale_y_continuous(trans = "log2") +
facet_wrap(eval(parse(text = facet_formula(covariates)))) +
guides(fill = guide_legend(title = "Titre type"), colour = "none")
}

Expand Down
Loading

0 comments on commit b3c8bd8

Please sign in to comment.