xpos = np.arange(0,4,1)ypos = np.arange(0,4,1)xpos, ypos = np.meshgrid(xpos, ypos)xpos = xpos.flatten()ypos = ypos.flatten()zpos = np.zeros(4*4)rho = np.random.random((4,4))dx = 0.5 * np.ones_like(zpos)dy = dx.copy()dz = rho.flatten()nrm=mpl.colors.Normalize(-1,1)colors=cm.RdBu(nrm(-dz))alpha = np.linspace(0.2, 0.95, len(xpos), endpoint=True)fig = plt.figure()ax = fig.gca(projection='3d')for i in range(len(xpos)): ax.bar3d(xpos[i],ypos[i],zpos[i], dx[i], dy[i], dz[i], alpha=alpha[i], color=colors[i], linewidth=0)plt.show()



