3D Surface

Breather Soliton Surface

Breather surface from sine-Gordon equation solutions in cyan-purple gradient.

Output
Breather Soliton Surface
Python
import matplotlib.pyplot as plt
import numpy as np
from matplotlib.colors import LinearSegmentedColormap

# Breather surface parameters
b = 0.4
u = np.linspace(-14, 14, 150)
v = np.linspace(-37, 37, 150)
u, v = np.meshgrid(u, v)

# Auxiliary quantities
r = 1 - b**2
w = np.sqrt(r)
denom = b * (((w * np.cosh(b * u))**2) + ((b * np.sin(w * v))**2))

x = -u + (2 * r * np.cosh(b * u) * np.sinh(b * u)) / denom
y = (2 * w * np.cosh(b * u) * (-(w * np.cos(v) * np.cos(w * v)) - np.sin(v) * np.sin(w * v))) / denom
z = (2 * w * np.cosh(b * u) * (-(w * np.sin(v) * np.cos(w * v)) + np.cos(v) * np.sin(w * v))) / denom

# Custom colormap
colors = ['#0a0a0f', '#0c4a6e', '#27D3F5', '#4927F5', '#c4b5fd']
cmap = LinearSegmentedColormap.from_list('cyan_purple', colors, N=256)

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

surf = ax.plot_surface(x, y, z, cmap=cmap, alpha=0.9, linewidth=0, edgecolor='none')

ax.set_xlabel('X', fontsize=10, color='#94a3b8', labelpad=10)
ax.set_ylabel('Y', fontsize=10, color='#94a3b8', labelpad=10)
ax.set_zlabel('Z', fontsize=10, color='#94a3b8', labelpad=10)
ax.set_title("Breather Soliton Surface", 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=20, azim=30)
plt.tight_layout()
plt.show()
Library

Matplotlib

Category

3D Charts

Did this help you?

Support PyLucid to keep it free & growing

Support