Hello,
you are using functions that you did not import explicitly. Probably you
imported Pylab and NumPy
automatically (which is the default in Spyder).
If you want to fix the warning add the following first line:
from pylab import linspace, plot, savefig
But the better (cleaner) solution is not to use pylab at all, but numpy and
matplotlib directly as
shown in the examples on the web, e.g.
http://matplotlib.org/examples/animation/basic_example.html:
import numpy as np
import matplotlib.pyplot as plt
and than use np.linspace plt.plot etc.
This is more explicit, it is clearer from which module the functions are coming
from and thus easier to
look up the documentation.
Best regards:
Uwe Fechner
Am 18.06.2013 05:33, schrieb Edgar Augusto:
Hi everybody.
Am new to Spyder (and Python in general), I just downloaded it on Mac OSX and
installed from the DMG.
I have some trouble with the Code Analysis.
In my script editor, some functions like linspace, plot, savefig, etc. are marked with a warning
sign, whose info box says somethings like:
Code Analysis
____________
undefined name 'linspace'
I have no idea if this is a regular error. I haven't seen any related posts.
Do I have to config something, or install something extra?
For example, such error appear on this sample code:
from scipy import special, optimize
f = lambda x: -special.jv(3, x)
sol = optimize.minimize(f, 1.0)
x = linspace(0, 10, 5000)
x
plot(x, special.jv(3, x), '-', sol.x, -sol.fun, 'o')
savefig('plot.png', dpi=96)
which runs without problems.
Thank you very much
Best regards
Edgar
--
You received this message because you are subscribed to the Google Groups
"spyder" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
[email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/spyderlib.
For more options, visit https://groups.google.com/groups/opt_out.
--
You received this message because you are subscribed to the Google Groups
"spyder" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/spyderlib.
For more options, visit https://groups.google.com/groups/opt_out.