3D Surface

Digital Elevation Model

Procedurally generated terrain surface with elevation-based coloring.

Output
Digital Elevation Model
Python
import matplotlib.pyplot as plt
import numpy as np
from matplotlib.colors import LinearSegmentedColormap

colors = ['#164e63', '#0d9488', '#22c55e', '#a3e635', '#fde047', '#f97316', '#7f1d1d']
cmap = LinearSegmentedColormap.from_list('terrain_neon', colors, N=256)

np.random.seed(42)
X = np.linspace(0, 10, 100)
Y = np.linspace(0, 10, 100)
X, Y = np.meshgrid(X, Y)

# Procedural terrain
Z = (np.sin(X*0.5) * np.cos(Y*0.5) * 2 + 
     np.sin(X*1.2 + 1) * np.cos(Y*0.8) + 
     0.5 * np.sin(X*2.5) * np.sin(Y*2.5))

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

surf = ax.plot_surface(X, Y, Z, cmap=cmap, linewidth=0, antialiased=True)

ax.set_xlabel('X (km)', color='#1f2937', fontsize=10)
ax.set_ylabel('Y (km)', color='#1f2937', fontsize=10)
ax.set_zlabel('Elevation', color='#1f2937', fontsize=10)
ax.set_title('Digital Elevation Model', 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=35, azim=45)
plt.tight_layout()
plt.show()
Library

Matplotlib

Category

3D Charts

Did this help you?

Support PyLucid to keep it free & growing

Support