3D Line
3D Lissajous Curve
A 3D Lissajous figure with frequency ratio 3:4:5, showing complex harmonic motion on a light background.
Output
Python
import matplotlib.pyplot as plt
import numpy as np
# 3D Lissajous curve
n = 1000
t = np.linspace(0, 2 * np.pi, n)
# Lissajous parameters
a, b, c = 3, 4, 5
delta_x, delta_y = np.pi/4, np.pi/2
x = np.sin(a * t + delta_x)
y = np.sin(b * t + delta_y)
z = np.sin(c * t)
fig = plt.figure(figsize=(10, 8), facecolor='#ffffff')
ax = fig.add_subplot(111, projection='3d', facecolor='#ffffff')
# Plot with gradient effect
ax.plot(x, y, z, color='#3b82f6', linewidth=2.5, alpha=0.3)
ax.plot(x, y, z, color='#1d4ed8', linewidth=1.5)
ax.set_xlim(-1.3, 1.3)
ax.set_ylim(-1.3, 1.3)
ax.set_zlim(-1.3, 1.3)
ax.set_xlabel('X', color='#1f2937', fontsize=10)
ax.set_ylabel('Y', color='#1f2937', fontsize=10)
ax.set_zlabel('Z', color='#1f2937', fontsize=10)
ax.set_title('3D Lissajous Curve (3:4:5)', 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.grid(True, alpha=0.3, color='#d1d5db')
ax.view_init(elev=20, azim=35)
plt.tight_layout()
plt.show()
Library
Matplotlib
Category
3D Charts
More 3D Line examples
☕