3D Trisurf

Bessel Function Trisurf

First-kind Bessel function J0 from radial sampling in coral-cyan gradient.

Output
Bessel Function Trisurf
Python
import matplotlib.pyplot as plt
import numpy as np
from scipy import special
from matplotlib.colors import LinearSegmentedColormap

# Radial sampling
n_radii = 18
n_angles = 50
radii = np.linspace(0.05, 3, n_radii)
angles = np.linspace(0, 2*np.pi, n_angles, endpoint=False)[..., np.newaxis]

x = np.append(0, (radii * np.cos(angles)).flatten())
y = np.append(0, (radii * np.sin(angles)).flatten())
r = np.sqrt(x**2 + y**2)
z = special.j0(3 * r)

# Custom colormap
colors = ['#0a0a0f', '#4a1942', '#F5276C', '#27D3F5', '#a5f3fc']
cmap = LinearSegmentedColormap.from_list('coral_cyan', 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='#ffffff10')

ax.set_xlabel('X', fontsize=10, color='#94a3b8', labelpad=10)
ax.set_ylabel('Y', fontsize=10, color='#94a3b8', labelpad=10)
ax.set_zlabel('Jā‚€(3r)', fontsize=10, color='#94a3b8', labelpad=10)
ax.set_title("Bessel Function Trisurf", 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=45)
plt.tight_layout()
plt.show()
Library

Matplotlib

Category

3D Charts

ā˜•

Did this help you?

Support PyLucid to keep it free & growing

Support