I Have created the following Cube and I would like to change the colour at position [15,9,0].
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
cube=np.ones((24,24,4),dtype='bool')
fig=plt.figure()
ax=plt.axes(projection = '3d')
ax.set_facecolor("Cyan")
ax.set_facecolor
ax.voxels(cube,facecolors="#E02050",edgecolors='k')
ax.axis('off')
plt.show()
How shall I proceed?
import matplotlib.pyplot as plt
import numpy as np
from mpl_toolkits.mplot3d import Axes3D
cube=np.ones((24,24,4),dtype='bool')
facecolors = np.full(cube.shape, "#E02050")
facecolors[15,9,0] = "#000000" #black
fig=plt.figure()
ax=plt.axes(projection = '3d')
ax.set_facecolor("Cyan")
ax.voxels(cube,facecolors=facecolors, edgecolors='k')
ax.axis('off')
plt.show()
But the face in position 15,9,0
is located on the base of the cube so you can't see it. Try:
import matplotlib.pyplot as plt
import numpy as np
from mpl_toolkits.mplot3d import Axes3D
cube=np.ones((24,24,4),dtype='bool')
facecolors = np.full(cube.shape, "#E02050")
facecolors[15,9,0] = "#000000"
fig=plt.figure()
ax=plt.axes(projection = '3d')
ax.set_facecolor("Cyan")
ax.voxels(cube,facecolors=facecolors, edgecolors=(0,0,0,.1), alpha=.5) #adding transparency to see the black face on the base
ax.axis('off')
plt.show()