3D Stem

Seismic Event Distribution

Earthquake epicenters displayed as 3D stems with height representing magnitude.

Output
Seismic Event Distribution
Python
import matplotlib.pyplot as plt
import numpy as np

np.random.seed(789)

# Seismic event data
n = 28
longitude = np.random.uniform(-120, -115, n)
latitude = np.random.uniform(32, 37, n)
magnitude = np.random.exponential(1.5, n) + 2

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

markerline, stemlines, baseline = ax.stem(longitude, latitude, magnitude, linefmt='-', markerfmt='o', basefmt=' ')
plt.setp(stemlines, color='#dc2626', linewidth=2, alpha=0.6)
plt.setp(markerline, color='#ef4444', markersize=8)

ax.set_xlabel('Longitude', color='#1f2937', fontsize=10)
ax.set_ylabel('Latitude', color='#1f2937', fontsize=10)
ax.set_zlabel('Magnitude', color='#1f2937', fontsize=10)
ax.set_title('Seismic Event Distribution', 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=30, azim=45)
plt.tight_layout()
plt.show()
Library

Matplotlib

Category

3D Charts

Did this help you?

Support PyLucid to keep it free & growing

Support