3D Scatter

Coral Reef Health Assessment

Marine biology survey showing coral coverage vs depth and temperature with health status.

Output
Coral Reef Health Assessment
Python
import matplotlib.pyplot as plt
import numpy as np

np.random.seed(666)

# Coral reef monitoring
n_sites = 130

depth = np.random.uniform(2, 30, n_sites)
temperature = 26 - depth * 0.15 + np.random.normal(0, 1, n_sites)
coral_cover = 60 - depth * 0.8 - (temperature - 25)**2 + np.random.normal(0, 10, n_sites)
coral_cover = np.clip(coral_cover, 5, 90)

# Health status
health = np.where(coral_cover > 50, 'Healthy', np.where(coral_cover > 25, 'Stressed', 'Bleached'))
health_colors = {'Healthy': '#27F5B0', 'Stressed': '#F5B027', 'Bleached': '#F5276C'}
colors = [health_colors[h] for h in health]

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

ax.scatter(depth, temperature, coral_cover, c=colors, s=60, 
           alpha=0.7, edgecolors='#374151', linewidths=0.3)

ax.set_xlabel('Depth (m)', color='#1f2937', fontsize=10)
ax.set_ylabel('Temperature (°C)', color='#1f2937', fontsize=10)
ax.set_zlabel('Coral Cover (%)', color='#1f2937', fontsize=10)
ax.set_title('Coral Reef Health Assessment', 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

Did this help you?

Support PyLucid to keep it free & growing

Support