import numpy as np
import matplotlib.pyplot as plt
E=[81.97400737666324, 322.0939978589591, 694.5766491226185]
V0=1000
a=0.1
def V(x):
   if x > -a and x < a:
       return 0
   return V0

V=np.vectorize(V)
#psi=np.vectorize(psi)
x= np.linspace(-1.5*a,1.5*a,100)

plt.plot(x,V(x))
plt.xlim(-5*a,5*a)
plt.ylim(-.001*V0,1.01*V0)
for m in E:
   x1=np.linspace(-a,+a,100)
   #y=m
   #plt.xlim(-5*a,5*a)
   #plt.axhline(m)
   #y=np.vectorize(y)
   plt.plot(x1,m)
   #plt.show()
   print m

Error:
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
C:\Python27\lib\site-packages\IPython\utils\py3compat.pyc in
execfile(fname, glob, loc)
   166             else:
   167                 filename = fname
--> 168             exec compile(scripttext, filename, 'exec') in glob, loc
   169     else:
   170         def execfile(fname, *where):

C:\Users\as\uy.py in <module>()
    23     #plt.axhline(m)

    24     #y=np.vectorize(y)

---> 25     plt.plot(x1,m)
    26     #plt.show()

    27     print m

C:\Python27\lib\site-packages\matplotlib\pyplot.pyc in plot(*args, **kwargs)
  2456         ax.hold(hold)
  2457     try:
-> 2458         ret = ax.plot(*args, **kwargs)
  2459         draw_if_interactive()
  2460     finally:

C:\Python27\lib\site-packages\matplotlib\axes.pyc in plot(self, *args, **kwargs)
  3846         lines = []
  3847
-> 3848         for line in self._get_lines(*args, **kwargs):
  3849             self.add_line(line)
  3850             lines.append(line)

C:\Python27\lib\site-packages\matplotlib\axes.pyc in
_grab_next_args(self, *args, **kwargs)
   321                 return
   322             if len(remaining) <= 3:
--> 323                 for seg in self._plot_args(remaining, kwargs):
   324                     yield seg
   325                 return

C:\Python27\lib\site-packages\matplotlib\axes.pyc in _plot_args(self,
tup, kwargs)
   298             x = np.arange(y.shape[0], dtype=float)
   299
--> 300         x, y = self._xy_from_xy(x, y)
   301
   302         if self.command == 'plot':

C:\Python27\lib\site-packages\matplotlib\axes.pyc in _xy_from_xy(self, x, y)
   238         y = np.atleast_1d(y)
   239         if x.shape[0] != y.shape[0]:
--> 240             raise ValueError("x and y must have same first dimension")
   241         if x.ndim > 2 or y.ndim > 2:
   242             raise ValueError("x and y can be no greater than 2-D")

ValueError: x and y must have same first dimension


Question:
then how to plot those specific component of E within the square well only?

------------------------------------------------------------------------------
Virtualization & Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing 
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to