Skip to content

Commit 21d7e4d

Browse files
committed
Add documentation for plotting and data visualization methods (#23)
1 parent 7d25be5 commit 21d7e4d

1 file changed

Lines changed: 65 additions & 0 deletions

File tree

examples/plotting_docs.py

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
"""
2+
CDPpy: Plotting and Data Visualization Documentation
3+
-----------------------------------------------------
4+
5+
This script demonstrates how to use CDPpy's built-in plotting and
6+
data visualization methods to explore and analyze cell culture data.
7+
"""
8+
9+
from cdippy import CDPpy
10+
11+
# Initialize CDPpy object
12+
cdp = CDPpy()
13+
14+
# Sample cell culture data
15+
data = {
16+
'time': [0, 1, 2, 3, 4, 5],
17+
'cell_density': [1.0, 1.2, 1.5, 1.9, 2.2, 2.5],
18+
'glucose_concentration': [5.0, 4.8, 4.5, 4.2, 4.0, 3.8]
19+
}
20+
21+
# -----------------------------
22+
# Basic Analysis
23+
# -----------------------------
24+
results = cdp.analyze(data)
25+
print("Analysis Results:")
26+
print(results)
27+
28+
# -----------------------------
29+
# Plotting Methods
30+
# -----------------------------
31+
32+
# 1. Plot a single variable against time
33+
cdp.plot(
34+
data,
35+
x='time',
36+
y='cell_density',
37+
title='Cell Density Over Time',
38+
xlabel='Time (hours)',
39+
ylabel='Cell Density (cells/mL)'
40+
)
41+
42+
# 2. Plot another variable
43+
cdp.plot(
44+
data,
45+
x='time',
46+
y='glucose_concentration',
47+
title='Glucose Concentration Over Time',
48+
xlabel='Time (hours)',
49+
ylabel='Glucose Concentration (mM)'
50+
)
51+
52+
# 3. Plot multiple variables together (if supported)
53+
cdp.plot_multiple(
54+
data,
55+
y=['cell_density', 'glucose_concentration'],
56+
title='Cell & Glucose Dynamics Over Time',
57+
xlabel='Time (hours)'
58+
)
59+
60+
# -----------------------------
61+
# Notes:
62+
# -----------------------------
63+
# - `plot()` is used for a single variable.
64+
# - `plot_multiple()` is used to compare multiple variables in one figure.
65+
# - Always include descriptive titles and axis labels for clarity.

0 commit comments

Comments
 (0)