| Title: | Pharmacometric Visualization for the pharmax Ecosystem |
|---|---|
| Description: | One-line pharmacometric diagnostic plots with modern aesthetics. Creates goodness-of-fit panels, spaghetti plots, and publication-ready exports with consistent theming for pharmacometric workflows. |
| Authors: | Malek Okour |
| Maintainer: | Malek Okour <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 0.2.0.9000 |
| Built: | 2026-05-27 11:01:02 UTC |
| Source: | https://github.com/pharmax-org/pharmax |
pharmax color palette
px_colors(n = 8)px_colors(n = 8)
n |
Number of colors. |
Character vector of hex colors.
Forest plot for estimates and intervals
px_forest( data, term = "term", estimate = "estimate", lower = "lower", upper = "upper", reference = 0, mode = "light" )px_forest( data, term = "term", estimate = "estimate", lower = "lower", upper = "upper", reference = 0, mode = "light" )
data |
Data frame with estimate and interval columns. |
term |
Term label column. |
estimate |
Estimate column. |
lower |
Lower interval column. |
upper |
Upper interval column. |
reference |
Reference line value. |
mode |
Theme mode passed to |
A ggplot2 object.
Creates a four-panel diagnostic plot: DV vs PRED, DV vs IPRED, CWRES vs TIME, and CWRES vs PRED.
px_gof(data, log_scale = TRUE, mode = "light")px_gof(data, log_scale = TRUE, mode = "light")
data |
Data frame with at least |
log_scale |
Use log10 axes for observed-vs-predicted panels. |
mode |
Theme mode passed to |
A patchwork plot object.
NPDE diagnostic panel
px_npde( data, npde = "NPDE", time = "TIME", prediction = "PRED", mode = "light" )px_npde( data, npde = "NPDE", time = "TIME", prediction = "PRED", mode = "light" )
data |
Data frame containing an NPDE-like column. |
npde |
NPDE column name. |
time |
Optional time column. |
prediction |
Optional prediction column. |
mode |
Theme mode passed to |
A patchwork plot object.
Compose pharmax plots
px_plot_grid( ..., ncol = 2, title = NULL, subtitle = NULL, caption = NULL, mode = "light" )px_plot_grid( ..., ncol = 2, title = NULL, subtitle = NULL, caption = NULL, mode = "light" )
... |
ggplot2 or patchwork plots, or a single list of plots. |
ncol |
Number of columns. |
title |
Optional grid title. |
subtitle |
Optional grid subtitle. |
caption |
Optional grid caption. |
mode |
Theme mode passed to |
A patchwork plot object.
Creates residual-vs-time, residual-vs-prediction, histogram, and QQ panels.
px_residuals( data, residual = NULL, time = "TIME", prediction = "PRED", mode = "light" )px_residuals( data, residual = NULL, time = "TIME", prediction = "PRED", mode = "light" )
data |
Data frame containing residual columns. |
residual |
Residual column. Auto-detects |
time |
Time column used for residual-vs-time when available. |
prediction |
Prediction column used for residual-vs-prediction when available. |
mode |
Theme mode passed to |
A patchwork plot object.
Save a pharmax plot
px_save(plot, filename, width = 8, height = 6, dpi = 300, ...)px_save(plot, filename, width = 8, height = 6, dpi = 300, ...)
plot |
A ggplot2 or patchwork plot. |
filename |
Output filename. |
width |
Width in inches. |
height |
Height in inches. |
dpi |
Resolution. |
... |
Additional arguments passed to |
The input filename, invisibly.
Individual PK concentration-time profiles
px_spaghetti( data, group = NULL, log_y = FALSE, facet_by = NULL, highlight_ids = NULL, mode = "light" )px_spaghetti( data, group = NULL, log_y = FALSE, facet_by = NULL, highlight_ids = NULL, mode = "light" )
data |
Data frame with |
group |
Optional grouping variable for color. |
log_y |
Use a log10 y-axis. |
facet_by |
Optional column to facet by. |
highlight_ids |
Optional vector of subject IDs to highlight. |
mode |
Theme mode passed to |
A ggplot2 object.
Lightweight visual predictive check
px_vpc( data, time = "TIME", observed = "DV", simulated = "SIM", bins = NULL, probs = c(0.05, 0.5, 0.95), mode = "light" )px_vpc( data, time = "TIME", observed = "DV", simulated = "SIM", bins = NULL, probs = c(0.05, 0.5, 0.95), mode = "light" )
data |
Data frame with observed and simulated values. |
time |
Time column. |
observed |
Observed concentration column. |
simulated |
Simulated concentration column. |
bins |
Number of time bins. If |
probs |
Quantiles to show for observed and simulated values. |
mode |
Theme mode passed to |
A ggplot2 object.
pharmax color scale for ggplot2
scale_color_pharmax(...) scale_fill_pharmax(...)scale_color_pharmax(...) scale_fill_pharmax(...)
... |
Arguments passed to |
A clean, publication-ready theme for pharmacometric graphics.
theme_pharmax(base_size = 12, base_family = "", mode = c("light", "dark"))theme_pharmax(base_size = 12, base_family = "", mode = c("light", "dark"))
base_size |
Base font size. |
base_family |
Base font family. |
mode |
Theme mode, either |
A ggplot2 theme object.
library(ggplot2) ggplot(mtcars, aes(wt, mpg)) + geom_point() + theme_pharmax()library(ggplot2) ggplot(mtcars, aes(wt, mpg)) + geom_point() + theme_pharmax()