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
Use this to plot it:
plot([x], [f(x)])you need the square brackets.
-Matt
--- "Davidlohr Bueso A." <[EMAIL PROTECTED]> 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 *
>
> d