3D Scatter

Drug Dose-Response Surface

Pharmacological dose-response relationship showing drug efficacy over concentration and time.

Output
Drug Dose-Response Surface
Python
import matplotlib.pyplot as plt
import numpy as np

np.random.seed(147)

# Drug response: concentration, time, response
n_samples = 180

# Multiple drug concentrations
concentration = np.random.uniform(0, 100, n_samples)  # μM
time = np.random.uniform(0, 72, n_samples)  # hours

# Response model (sigmoidal with time decay)
EC50 = 30
response = 100 / (1 + (EC50 / (concentration + 0.1))**2) * (1 - np.exp(-time/24))
response += np.random.normal(0, 5, n_samples)
response = np.clip(response, 0, 100)

fig = plt.figure(figsize=(10, 8), facecolor='#ffffff')
ax = fig.add_subplot(111, projection='3d', facecolor='#ffffff')

scatter = ax.scatter(concentration, time, response, c=response, cmap='RdYlGn', 
                     s=50, alpha=0.7, edgecolors='#374151', linewidths=0.5)

cbar = plt.colorbar(scatter, ax=ax, shrink=0.6, pad=0.1)
cbar.set_label('Response (%)', color='#1f2937', fontsize=10)
cbar.ax.tick_params(colors='#6b7280')

ax.set_xlabel('Concentration (μM)', color='#1f2937', fontsize=10)
ax.set_ylabel('Time (hours)', color='#1f2937', fontsize=10)
ax.set_zlabel('Response (%)', color='#1f2937', fontsize=10)
ax.set_title('Drug Dose-Response Surface', 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=25, azim=45)
plt.tight_layout()
plt.show()
Library

Matplotlib

Category

3D Charts

Did this help you?

Support PyLucid to keep it free & growing

Support