In a message of Thu, 12 Nov 2015 17:54:28 -0800, Abhishek writes: >I am trying to run some Python code for the last few hours. How can I achieve >the effect of "dot divide" from Matlab, in the following code? I am having >trouble working with list comprehension and numpy arrays and getting the >following error: > > Traceback (most recent call last): > File "Thurs.py", line 128, in <module> > plt.plot(np.array(range(1,N/2+2)), > Splot[alpha][iii,val]/utot[iii,val],color=cmap(iii/50)) > > ValueError: x and y must have same first dimension
Splot is a list. matplotlib wants 2 numpy arrays. You have to cast it with np.array() too. no guarantees that the rest of the code works -- it is not plotting for me -- but that gets rid of that error at any rate. Laura -- https://mail.python.org/mailman/listinfo/python-list