Simple numpy reshape error wih contour3D - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: Data Science (https://python-forum.io/forum-44.html) +--- Thread: Simple numpy reshape error wih contour3D (/thread-21157.html) |
Simple numpy reshape error wih contour3D - AdeIsHere - Sep-17-2019 I create X and Y with X = np.arange(0,34, 1) Y = np.arange(0,22, 1) X,Y = np.meshgrid(X,Y)ie X goes from 0..33 and Y goes from 0.21 My Z values are in a list and go like this X0Y0val, X0Y1val,...X0Y1val, X1Y0val,....,X33Y21val I reshape these to get 2d array that matches X and Y above Z = np.reshape(zline, [34, 22], 'C')but when I use it in my contour3D call: myplot = ax.contour3D(X, Y, Z, 50, cmap=cm.coolwarm, linewidth=0, antialiased=False)I get this error: Changing the reshapoe call to have [22,34] fixes the error but seems illogical.What is the problem ? |