3D Scatter
Clinical Trial Efficacy & Safety
Medical trial analysis showing treatment response and adverse events by dosage group.
Output
Python
import matplotlib.pyplot as plt
import numpy as np
np.random.seed(579)
# Clinical trial patient data
n_patients = 160
baseline_score = np.random.uniform(40, 80, n_patients)
week12_score = baseline_score + np.random.normal(15, 10, n_patients)
week12_score = np.clip(week12_score, 20, 100)
adverse_events = np.random.poisson(1.5, n_patients)
# Treatment group
treatment = np.random.choice(['Placebo', 'Low Dose', 'High Dose'], n_patients)
treat_colors = {
'Placebo': '#94a3b8',
'Low Dose': '#27D3F5',
'High Dose': '#6CF527'
}
colors = [treat_colors[t] for t in treatment]
fig = plt.figure(figsize=(10, 8), facecolor='#ffffff')
ax = fig.add_subplot(111, projection='3d', facecolor='#ffffff')
ax.scatter(baseline_score, week12_score, adverse_events, c=colors, s=60,
alpha=0.7, edgecolors='#374151', linewidths=0.3)
# Reference line (no change)
ax.plot([40, 80], [40, 80], [0, 0], color='#ef4444', linestyle='--', alpha=0.5)
ax.set_xlabel('Baseline Score', color='#1f2937', fontsize=10)
ax.set_ylabel('Week 12 Score', color='#1f2937', fontsize=10)
ax.set_zlabel('Adverse Events', color='#1f2937', fontsize=10)
ax.set_title('Clinical Trial Efficacy & Safety', color='#1f2937', fontsize=14, fontweight='bold', pad=20)
ax.tick_params(colors='#6b7280', labelsize=8)
ax.xaxis.pane.fill = False
ax.yaxis.pane.fill = False
ax.zaxis.pane.fill = False
ax.xaxis.pane.set_edgecolor('#e5e7eb')
ax.yaxis.pane.set_edgecolor('#e5e7eb')
ax.zaxis.pane.set_edgecolor('#e5e7eb')
ax.view_init(elev=20, azim=45)
plt.tight_layout()
plt.show()
Library
Matplotlib
Category
3D Charts
☕