3D Scatter
Earthquake Epicenters Along Fault
3D visualization of earthquake epicenters along a fault line, with depth and magnitude.
Output
Python
import matplotlib.pyplot as plt
import numpy as np
np.random.seed(789)
# Simulate earthquake data along fault line
n_quakes = 150
# Fault line pattern (linear with scatter)
t = np.linspace(0, 10, n_quakes)
x = t + np.random.normal(0, 0.3, n_quakes)
y = 0.5 * t + np.random.normal(0, 0.5, n_quakes)
z = -np.random.exponential(20, n_quakes) # Depth (negative)
# Magnitude for size and color
magnitude = np.random.exponential(1.5, n_quakes) + 2
sizes = magnitude ** 2 * 10
fig = plt.figure(figsize=(10, 8), facecolor='#ffffff')
ax = fig.add_subplot(111, projection='3d', facecolor='#ffffff')
scatter = ax.scatter(x, y, z, c=magnitude, cmap='YlOrRd', s=sizes,
alpha=0.7, edgecolors='#7f1d1d', linewidths=0.5)
cbar = plt.colorbar(scatter, ax=ax, shrink=0.6, pad=0.1)
cbar.set_label('Magnitude', color='#1f2937', fontsize=10)
cbar.ax.tick_params(colors='#6b7280')
ax.set_xlabel('Longitude', color='#1f2937', fontsize=10)
ax.set_ylabel('Latitude', color='#1f2937', fontsize=10)
ax.set_zlabel('Depth (km)', color='#1f2937', fontsize=10)
ax.set_title('Earthquake Epicenters Along Fault', 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=35)
plt.tight_layout()
plt.show()
Library
Matplotlib
Category
3D Charts
☕