3D Voxels
3D Cross Structure
Three-dimensional cross/plus shape with lime-green neon coloring.
Output
Python
import matplotlib.pyplot as plt
import numpy as np
# Prepare coordinates
n = 11
x, y, z = np.indices((n, n, n))
center = n // 2
arm_width = 2
# Three axes of the cross
x_arm = (np.abs(y - center) <= arm_width) & (np.abs(z - center) <= arm_width)
y_arm = (np.abs(x - center) <= arm_width) & (np.abs(z - center) <= arm_width)
z_arm = (np.abs(x - center) <= arm_width) & (np.abs(y - center) <= arm_width)
cross = x_arm | y_arm | z_arm
# Lime #6CF527 color
colors = np.empty(cross.shape + (4,), dtype=np.float32)
colors[..., 0] = 0.42 # R (6C)
colors[..., 1] = 0.96 # G (F5)
colors[..., 2] = 0.15 # B (27)
colors[..., 3] = 0.9
fig = plt.figure(figsize=(10, 8), facecolor='#020B14')
ax = fig.add_subplot(111, projection='3d', facecolor='#020B14')
ax.voxels(cross, facecolors=colors, edgecolor='#ffffff20', linewidth=0.2)
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("3D Cross Structure", 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=25, azim=45)
plt.tight_layout()
plt.show()
Library
Matplotlib
Category
3D Charts
More 3D Voxels examples
☕