Skip to content

Visualization Examples

Examples demonstrating plotting and visualization for pharmacometric analyses.

Plot Types

Plot Use Case Directory
Concentration-Time Single subject PK 01_concentration_time
Spaghetti Plot Population PK 02_population_spaghetti
VPC Plot Model validation 03_vpc_plots
Diagnostics Estimation GOF 04_estimation_diagnostics

Quick Start

from neopkpd.viz import plot_concentration_time, plot_vpc, plot_gof
import matplotlib.pyplot as plt

# Concentration-time plot
fig, ax = plot_concentration_time(result, title="PK Profile")
plt.savefig("pk_profile.png")

# VPC plot
fig, ax = plot_vpc(vpc_result, title="Visual Predictive Check")
plt.savefig("vpc.png")

# Goodness-of-fit
fig = plot_gof(estimation_result)
plt.savefig("gof.png")

Customization

All plotting functions return matplotlib figures that can be customized:

fig, ax = plot_concentration_time(result)
ax.set_xlabel("Time (hours)")
ax.set_ylabel("Concentration (ng/mL)")
ax.set_xlim(0, 24)
ax.grid(True, alpha=0.3)
fig.savefig("custom_plot.png", dpi=300, bbox_inches="tight")

See Also