3D Stem
Sampled Helix Trajectory
Discrete samples along a helical path showing 3D stem visualization of continuous trajectory.
Output
Python
import matplotlib.pyplot as plt
import numpy as np
# Sampled helix path
n = 40
t = np.linspace(0, 4*np.pi, n)
x = np.cos(t)
y = np.sin(t)
z = t / (4*np.pi)
fig = plt.figure(figsize=(10, 8), facecolor='#ffffff')
ax = fig.add_subplot(111, projection='3d', facecolor='#ffffff')
markerline, stemlines, baseline = ax.stem(x, y, z, linefmt='-', markerfmt='o', basefmt=' ')
plt.setp(stemlines, color='#14b8a6', linewidth=1.5, alpha=0.7)
plt.setp(markerline, color='#2dd4bf', markersize=7)
# Add guide line
t_smooth = np.linspace(0, 4*np.pi, 200)
ax.plot(np.cos(t_smooth), np.sin(t_smooth), t_smooth/(4*np.pi),
color='#5eead4', linewidth=1, alpha=0.4)
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('Sampled Helix Trajectory', 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=20, azim=45)
plt.tight_layout()
plt.show()
Library
Matplotlib
Category
3D Charts
More 3D Stem examples
☕