From: Andrea Riciputi <ariciputi@pi...>  20040830 07:03:08

Hi, suppose I want to use functions defined in a python module (namely Numeric or math) to plot a graph. Defining a function and then using "context = locals()" doesn't work. Here it is a minimal example: import pyx import math def my_f(x): return math.log10(x) h = pyx.graph.graphxy(width = 10, height = 10,\ x = pyx.graph.axis.log(min = .01, max = 100.),\ y = pyx.graph.axis.log(min = 2, max = +3),\ key = pyx.graph.key.key(pos = "rb")) h.plot(pyx.graph.data.function("y=my_f(x)", context = locals())) h.writeEPSfile("minimal.eps") In order to get the previous example working I must change "import math" into "from math import log10" and then change "my_f" definition accordingly. I'm sure the problem here is my poor understanding of the "context" parameter, but reading the manual hasn't helped so much. How can I get the example working as is? Thanks, Andrea. 