Davidlohr Bueso A. wrote: > Hi, > > I am having trouble graphing constant functions in matplotlib (a simple > y = 2). Here is a simple test script I'm using: > > from pylab import * > > def f(x): > return 2
Try return 2*ones(shape(x)) The problem is that you are returning a scalar, not an array the same size as x; mpl plots arrays, not scalars. Eric ------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 _______________________________________________ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users