From: Miguel C. <mig...@gm...> - 2010-11-22 17:43:18
|
Hello all. I'm attempting to use bar3d to plot a packing solution but from some viewpoints the perspective is wrong (boxes seem overlapped), and with a large number of boxes the plot is always incoherent. (I'm using matplotlib 1.0.0 on fedora 14) Does anyone know how to fix this? Cheers, Miguel Example code: ----------------------------------------------------------------------- import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D # setup figure fig = plt.figure() ax = fig.add_subplot(111, projection='3d') ax.set_xlim3d(0, 10) ax.set_ylim3d(0, 10) ax.set_zlim3d(0, 10) # boxes x = [0,2,0,2,0] y = [0,0,2,2,0] z = [0,0,0,0,2] dx = [2,2,2,2,3] dy = [2,2,2,2,3] dz = [2,2,2,2,3] colors = ['b','b','b','b','g'] # draw ax.bar3d(x, y, z, dx, dy, dz, color=colors, alpha=1.0) # perspective ax.view_init(azim=48.0, elev=20.0) # problem #ax.view_init(azim=48.0, elev=45.0) # no problem # show plt.show() |