Dani Marti venit, vidit, dixit 2006-08-29 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
-------------------------------------------------------------------------
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
_______________________________________________
PyX-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/pyx-user