numpy - Long error in contour plot python -


i trying create contour plot x coordinates being label ef , y being labeled eb , z being function labeled a. returns long error posted below. appreciated. error is

file "contour.py", line 19, in <module> c = plt.contour(ef,eb,a)   file "/usr/lib/pymodules/python2.7/matplotlib/pyplot.py", line 2016, in contour     ret = ax.contour(*args, **kwargs)   file "/usr/lib/pymodules/python2.7/matplotlib/axes.py", line 7326, in contour     return mcontour.quadcontourset(self, *args, **kwargs)   file "/usr/lib/pymodules/python2.7/matplotlib/contour.py", line 1088, in __init__     contourset.__init__(self, ax, *args, **kwargs)   file "/usr/lib/pymodules/python2.7/matplotlib/contour.py", line 686, in __init__     self._process_args(*args, **kwargs)   file "/usr/lib/pymodules/python2.7/matplotlib/contour.py", line 1101, in _process_args     x, y, z = self._contour_args(args, kwargs)   file "/usr/lib/pymodules/python2.7/matplotlib/contour.py", line 1148, in _contour_args     x,y,z = self._check_xyz(args[:3], kwargs)   file "/usr/lib/pymodules/python2.7/matplotlib/contour.py", line 1180, in _check_xyz     raise typeerror("input z must 2d array.") typeerror: input z must 2d array. 

the error states that

typeerror: input z must 2d array.  

if @ sizes of input objects:

print ef.shape, eb.shape, a.shape (51,) (51,) (51,) 

you'll see these not 2d arrays. did intend use x , y instead?

when make change to

a = ((1+.5*(np.exp(1.7*x)+np.exp(1.7*y)+np.exp(1.7*(x+y))))/(1+np.exp(1.7*x)+np.exp(1.7*y)+np.exp(1.7*(x+y)))) c = plt.contour(ef,eb,a,30) 

the output is

enter image description here

it looks may need adjust parameter space since interesting stuff around (0,0).


Comments

Popular posts from this blog

java - Run a .jar on Heroku -

java - Jtable duplicate Rows -

validation - How to pass paramaters like unix into windows batch file -