3D Trisurf
Bathymetry Ocean Floor
Simulated ocean floor bathymetry with ridges and trenches in blue-teal gradient.
Output
Python
import matplotlib.pyplot as plt
import numpy as np
from matplotlib.colors import LinearSegmentedColormap
# Scattered bathymetric measurements
np.random.seed(44)
n_points = 700
x = np.random.uniform(0, 10, n_points)
y = np.random.uniform(0, 10, n_points)
# Ocean floor with ridge and trench
ridge = 0.8 * np.exp(-((y - 5)**2)/2) * np.sin(x * 0.5)
trench = -0.5 * np.exp(-((x - 7)**2 + (y - 3)**2)/3)
base = -2 + 0.1 * np.sin(x) * np.cos(y * 0.8)
z = base + ridge + trench
# Custom colormap
colors = ['#0a0a0f', '#0c4a6e', '#276CF5', '#14b8a6', '#5eead4']
cmap = LinearSegmentedColormap.from_list('blue_teal', colors, N=256)
fig = plt.figure(figsize=(10, 8), facecolor='#0a0a0f')
ax = fig.add_subplot(111, projection='3d', facecolor='#0a0a0f')
surf = ax.plot_trisurf(x, y, z, cmap=cmap, alpha=0.9, linewidth=0.1, edgecolor='#ffffff08')
ax.set_xlabel('Longitude', fontsize=10, color='#94a3b8', labelpad=10)
ax.set_ylabel('Latitude', fontsize=10, color='#94a3b8', labelpad=10)
ax.set_zlabel('Depth (km)', fontsize=10, color='#94a3b8', labelpad=10)
ax.set_title("Bathymetry Ocean Floor", fontsize=14, color='white', fontweight='bold', pad=20)
ax.tick_params(colors='#64748b', labelsize=8)
ax.xaxis.pane.fill = False
ax.yaxis.pane.fill = False
ax.zaxis.pane.fill = False
ax.xaxis.pane.set_edgecolor('#1e293b')
ax.yaxis.pane.set_edgecolor('#1e293b')
ax.zaxis.pane.set_edgecolor('#1e293b')
ax.view_init(elev=25, azim=135)
plt.tight_layout()
plt.show()
Library
Matplotlib
Category
3D Charts
More 3D Trisurf examples
☕