3D Voxels
Hemisphere Dome Voxels
Half-sphere dome structure with orange-amber gradient.
Output
Python
import matplotlib.pyplot as plt
import numpy as np
n = 12
voxels = np.zeros((n, n, n), dtype=bool)
# Create frame edges only
# Bottom frame
voxels[0, :, 0] = True
voxels[:, 0, 0] = True
voxels[n-1, :, 0] = True
voxels[:, n-1, 0] = True
# Top frame
voxels[0, :, n-1] = True
voxels[:, 0, n-1] = True
voxels[n-1, :, n-1] = True
voxels[:, n-1, n-1] = True
# Vertical edges
voxels[0, 0, :] = True
voxels[n-1, 0, :] = True
voxels[0, n-1, :] = True
voxels[n-1, n-1, :] = True
# Alternating coral #F5276C and cyan #27D3F5
colors = np.empty(voxels.shape + (4,), dtype=np.float32)
colors[..., 3] = 0
x, y, z = np.indices((n, n, n))
coral_mask = voxels & ((x + y + z) % 2 == 0)
cyan_mask = voxels & ((x + y + z) % 2 == 1)
# Coral
colors[coral_mask, 0] = 0.96
colors[coral_mask, 1] = 0.15
colors[coral_mask, 2] = 0.42
colors[coral_mask, 3] = 0.9
# Cyan
colors[cyan_mask, 0] = 0.15
colors[cyan_mask, 1] = 0.83
colors[cyan_mask, 2] = 0.96
colors[cyan_mask, 3] = 0.9
fig = plt.figure(figsize=(10, 8), facecolor='#020B14')
ax = fig.add_subplot(111, projection='3d', facecolor='#020B14')
ax.voxels(voxels, facecolors=colors, edgecolors='#1e293b', linewidth=0.5)
ax.set_xlabel('X', fontsize=11, color='#94a3b8', labelpad=10)
ax.set_ylabel('Y', fontsize=11, color='#94a3b8', labelpad=10)
ax.set_zlabel('Z', fontsize=11, color='#94a3b8', labelpad=10)
ax.set_title('Frame Structure Voxels', 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.grid(True, alpha=0.2, color='#475569')
plt.tight_layout()
plt.show()
Library
Matplotlib
Category
3D Charts
More 3D Voxels examples
☕