plot_observed_profiles: Spaghetti plot

View source: R/plot_observed_profiles.R

plot_observed_profilesR Documentation

Spaghetti plot

Description

Plot of observed profiles versus an independent variable (e.g. TIME or TAD).

Usage

plot_observed_profiles(
  run,
  compartment = NULL,
  idv = "TIME",
  ids = NULL,
  show_mdv = TRUE,
  log_dv = FALSE,
  mean_profiles = FALSE,
  x_scale = "linear",
  y_scale = "linear",
  logticks_annotation = TRUE,
  facetted = TRUE,
  facet_scales = "free",
  transparency = FALSE,
  auto_legend = TRUE
)

Arguments

run

pmxploit NONMEM run object.

compartment

integer. Number of the compartment of the dependent variable.

idv

character. Name of the column used as independent variable. Default is "TIME".

ids

integer vector of the IDs of the individuals to plot. Default is NULL, plotting all the individuals.

log_dv

logical. Set it to TRUE is dependent variable is in log-scale in the dataset. Default is FALSE.

mean_profiles

logical. If TRUE, summarizes individual profiles by the mean profile (in each group if split_by is specified).

x_scale

character. X-axis scale, one of "linear" or "log". Default is "linear".

y_scale

character. Y-axis scale, one of "linear" or "log". Default is "linear".

logticks_annotation

logical. If x_scale and/or y_scale are "log", adds ticks annotation on the axis.

facetted

logical. If TRUE (default) and split_by is specified, plot each group in a separate facet. Otherwise, draw groups in different colours.

facet_scales

character. ggplot2 facet scales. Default is "free".

transparency

logical. Plot scatterplot dots with transparency, useful to avoid overplotting with large datasets. Default is FALSE.

auto_legend

logical. When TRUE (default), default pmxploit plotting options are applied (title, labels, axis...).

Value

A ggplot2 object.

Examples

EXAMPLERUN %>% plot_observed_profiles(compartment = 2)

EXAMPLERUN %>% group_by(CMT) %>% plot_observed_profiles(compartment = 2:3)

EXAMPLERUN %>% group_by(SEX) %>% plot_observed_profiles(compartment = 2)
EXAMPLERUN %>% group_by(SEX) %>% plot_observed_profiles(compartment = 2, facetted = FALSE)

EXAMPLERUN %>% group_by(SEX) %>% plot_observed_profiles(compartment = 2, mean_profiles = TRUE)
EXAMPLERUN %>% group_by(SEX) %>%
  plot_observed_profiles(compartment = 2, mean_profiles = TRUE, facetted = FALSE)

EXAMPLERUN %>%
  group_by(SEX) %>%
  plot_observed_profiles(compartment = 2, y_scale = "log", facetted = FALSE)

pnolain/pmxploit documentation built on Jan. 31, 2024, 1:16 p.m.