3D Stem
Quantum State Tomography
Quantum computing visualization showing qubit measurement outcomes in Bloch sphere coordinates.
Output
Python
import matplotlib.pyplot as plt
import numpy as np
np.random.seed(555)
# Quantum measurement outcomes
n = 25
qubit_x = np.random.choice([-1, 1], n) * np.random.uniform(0.8, 1, n)
qubit_y = np.random.choice([-1, 1], n) * np.random.uniform(0.8, 1, n)
probability = np.random.uniform(0.1, 1, n)
fig = plt.figure(figsize=(10, 8), facecolor='#0a0a0f')
ax = fig.add_subplot(111, projection='3d', facecolor='#0a0a0f')
markerline, stemlines, baseline = ax.stem(qubit_x, qubit_y, probability, linefmt='-', markerfmt='o', basefmt=' ')
plt.setp(stemlines, color='#8b5cf6', linewidth=1.5, alpha=0.7)
plt.setp(markerline, color='#a78bfa', markersize=8)
ax.set_xlabel('⟨σx⟩', color='white', fontsize=10)
ax.set_ylabel('⟨σy⟩', color='white', fontsize=10)
ax.set_zlabel('Probability', color='white', fontsize=10)
ax.set_title('Quantum State Tomography', color='white', fontsize=14, 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
More 3D Stem examples
☕