python - 3d bar plot of lists using matplotlib, pylab -


i have 3 lists

 def main():      x = np.arange(0.0,256.0)      y = np.arange(0.0,256.0)      y,x = np.meshgrid(x,y)      z = wron(x,y)      in range(0,256):          z[i][0]=0   def wron(x,y):      t=x/y      return(abs(t*(t-1))) 

how 3d bar plot of x,y , z lists. x,y,z corresponds x,y,z axes.

i tried following code.

 pylab import *  import numpy  mpl_toolkits.mplot3d import axes3d   def main():    fig=figure()    ax=axes3d(fig)    x=np.arange(0.0,256.0)    y=np.arange(0.0,256.0)    y,x= np.meshgrid(x,y)    z=wron(x,y)    in range(0,256):      z[i][0]=0    ax.bar(x,y,zs=z,zdir='y')    show()  def wron(x,y):    t=x/y    return(abs(t*(t-1)))   if __name__=='__main__':    main() 

but error:

patches = axes.bar(self, left, height, *args, **kwargs)  file "/usr/lib/python3/dist-packages/matplotlib/axes.py", line 4887, in bar  if h<0:   valueerror: truth value of array more 1 element ambiguous. use a.any() or a.all() 


Comments