3D Trisurf

Langermann Function Trisurf

Langermann multimodal function with cosine-weighted Gaussians in teal-blue gradient.

Output
Langermann Function Trisurf
Python
import matplotlib.pyplot as plt
import numpy as np
from matplotlib.colors import LinearSegmentedColormap

# Scattered sampling
np.random.seed(88)
n_points = 600
x = np.random.uniform(0, 10, n_points)
y = np.random.uniform(0, 10, n_points)

# Langermann function (simplified)
A = np.array([[3, 5], [5, 2], [2, 1], [1, 4], [7, 9]])
c = np.array([1, 2, 5, 2, 3])
m = 5

z = np.zeros_like(x)
for i in range(m):
    dist = (x - A[i, 0])**2 + (y - A[i, 1])**2
    z += c[i] * np.exp(-dist/np.pi) * np.cos(np.pi * dist)

# Custom colormap
colors = ['#ffffff', '#ccfbf1', '#14b8a6', '#276CF5', '#93c5fd']
cmap = LinearSegmentedColormap.from_list('teal_blue', colors, N=256)

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

surf = ax.plot_trisurf(x, y, z, cmap=cmap, alpha=0.85, linewidth=0.1, edgecolor='#33333308')

ax.set_xlabel('X', fontsize=10, color='#374151', labelpad=10)
ax.set_ylabel('Y', fontsize=10, color='#374151', labelpad=10)
ax.set_zlabel('f(x,y)', fontsize=10, color='#374151', labelpad=10)
ax.set_title("Langermann Function Trisurf", fontsize=14, color='#1f2937', 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