From: Michael J Gruber <michaeljgruber+<pyx@fa...>  20060829 13:52:59

Dani Marti venit, vidit, dixit 20060829 15:44: > Thank you Michael for your answer. I'm glad I was pointing to the good > direction. The concept is now clear to me, but I don't know how to > implement it. From my previous example > > A = generate_graph(0), > > My question is, what precise object should the function "generate_graph" > return? > > Is there anything wrong in > > def generate_graph(parameter): > g = graph.graphxy(width=1, height=1) > g.plot(graph.data.function("y(x)= x**4  %f * x**2" % parameter, min=2, max=2)) > return g > > A = generate_graph(1) > ? > > [There are no errors, but I wonder if this the proper way to do it] Yes, this is exactly what I meant. graph.graphxy returns a canvas. >> As for the positioning: graph.graphxy() accepts parameters xpos and >> ypos just like the first two parameters of text.text() (or translate >> the graph canvasses). > That's precisely what I prefer not to do: to specify the position at the > very beginning, through the 'graph.graphxy' call inside 'generate_graph'. > This would require to modify the function 'generate_graph' to add a > second argument (the position), which I don't want to do. My idea is to > create the 'floating' figure (using Gimp terminology) and then 'anchor' > it at the position I choose at the end. Is that possible? Yes, that's what I meant by "translate canvas". Sorry for being so concise... Uh, Joerg was faster, he just sent you the translate code ;) Happy PyXing! Michael 