Want to scale the voxel-dimensions with Matplotlib. How can I do this?
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
You can pass custom coordinates to the voxels
function: API reference.
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
fig = plt.figure()
ax = fig.gca(projection='3d')
# Make grid
test2 = np.zeros((6, 6, 6))
# Activate single Voxel
test2[1, 0, 4] = True
# Custom coordinates for grid
x,y,z = np.indices((7,7,7))/2
# Pass the custom coordinates as extra arguments
ax.voxels(x, y, z, test2, edgecolor="k")
ax.set_xlabel('0 - Dim')
ax.set_ylabel('1 - Dim')
ax.set_zlabel('2 - Dim')
plt.show()
Which would yield: