Skip to content

Commit

Permalink
pr suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
hillalex committed Oct 29, 2024
1 parent 088629c commit 9c40c2d
Show file tree
Hide file tree
Showing 4 changed files with 3,845 additions and 28 deletions.
2 changes: 1 addition & 1 deletion R/biokinetics.R
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ biokinetics <- R6::R6Class(
#' log or a natural scale.
#' @return A ggplot2 object.
plot_model_inputs = function() {
plot_data(private$data, private$all_formula_vars)
plot_sero_data(private$data, private$all_formula_vars)
},
#' @description View the data that is passed to the stan model, for debugging purposes.
#' @return A list of arguments that will be passed to the stan model.
Expand Down
7 changes: 4 additions & 3 deletions R/plot.R
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ plot.biokinetics_priors <- function(x,
plot
}

plot_data <- function(data, covariates) {
plot_sero_data <- function(data, covariates = character(0)) {
validate_required_cols(data, c("time_since_last_exp", "value", "titre_type"))
# Declare variables to suppress notes when compiling package
# https://github.com/Rdatatable/data.table/issues/850#issuecomment-259466153
Expand All @@ -68,7 +68,7 @@ plot_data <- function(data, covariates) {
#' Plot method for "biokinetics_population_trajectories" class
#'
#' @param x An object of class "biokinetics_population_trajectories". These are
#' generated by running biokinetics$simulate_populate_trajectories(). See
#' generated by running biokinetics$simulate_population_trajectories(). See
#' \href{../../epikinetics/html/biokinetics.html#method-biokinetics-simulate_population_trajectories}{\code{biokinetics$simulate_population_trajectories()}}
#' @param \dots Further arguments passed to the method.
#' @param data Optional data.table containing raw data as provided to the biokinetics model.
Expand All @@ -90,7 +90,8 @@ plot.biokinetics_population_trajectories <- function(x, ..., data = NULL) {
fill = titre_type), alpha = 0.5)
} else {
plot <- ggplot(x) +
geom_line(aes(x = time_since_last_exp, y = mu, colour = titre_type), alpha = 0.5)
geom_line(aes(x = time_since_last_exp, y = mu,
colour = titre_type, group = .draw), alpha = 0.1, linewidth = 0.1)
}

if (!is.null(data)) {
Expand Down
2,898 changes: 2,880 additions & 18 deletions tests/testthat/_snaps/plots/multiplecovariates-unsum.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
966 changes: 960 additions & 6 deletions tests/testthat/_snaps/plots/populationtrajectories-unsum.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 9c40c2d

Please sign in to comment.