Spaghetti Chart
Chart overview
A spaghetti chart (or individual trajectory plot) draws a separate line for each subject in a longitudinal dataset, making it possible to see both the overall population trend and the variability between individuals simultaneously.
Key points
- In clinical research, it is the standard exploratory tool for pharmacokinetic time-concentration profiles, disease biomarker trajectories over a treatment course, growth monitoring in pediatric cohorts, and ecological time-series where individual-level heterogeneity matters.
- When many lines overlap, a mean or median trajectory line with confidence interval or IQR shading is overlaid in a contrasting color to summarize the central tendency.
- Coloring lines by subgroup (treatment arm, responder status, genetic genotype) reveals how different strata follow distinct trajectories.
Example Visualization

Create This Chart Now
Generate publication-ready spaghetti charts with AI in seconds. No coding required – just describe your data and let AI do the work.
View example prompt
"Create a spaghetti chart from my longitudinal clinical study data with columns: patient_id, timepoint, biomarker_value, treatment_group. Plot each patient's trajectory as a thin semi-transparent line colored by treatment group. Overlay the group mean trajectory as a bold line with 95% CI shading for each group. Label timepoints on the x-axis, biomarker on the y-axis. Add a legend for treatment groups and annotate the number of subjects per group. Format for publication at 300 DPI."
How to create this chart in 30 seconds
Upload Data
Drag & drop your Excel or CSV file. Plotivy securely processes it in your browser.
AI Generation
Our AI analyzes your data and generates the Spaghetti Chart code automatically.
Customize & Export
Tweak the design with natural language, then export as high-res PNG, SVG or PDF.
Python Code Example
Console Output
Figure saved: plotivy-spaghetti-chart.png
Common Use Cases
- 1Pharmacokinetics: displaying individual drug concentration-time profiles vs. population model predictions
- 2Clinical trials: showing per-patient biomarker trajectories stratified by responder vs. non-responder status
- 3Longitudinal cohort studies: growth trajectories for weight, height, or bone density across a pediatric cohort
- 4Ecology: individual animal GPS tracking paths converted to temporal behavioral or movement trajectories
Pro Tips
Use low alpha (0.1-0.3) for individual lines to prevent overplotting while still revealing trajectory density
Overlay a bold mean or median line with shaded confidence interval to anchor the reader's interpretation
Color by a clinically or biologically meaningful grouping variable to reveal subgroup trajectory differences
Include a rug plot or dot markers at each measured timepoint if the measurement schedule is irregular
Scientific Chart Selection Cheat Sheet
Not sure whether to use a Violin Plot, Box Plot, or Ridge Plot? Download our single-page reference mapping the most-used scientific chart types, exactly when to use them, and the core Matplotlib/Seaborn functions.