Hello Dani,

On 29.08.06, Dani Marti wrote:
> 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)

That's perfect.

> > 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?

Just do something like

c.insert(A, [trafo.translate(xpos, ypos)])

where c is a canvas and xpos and ypos are the desired positions of the
graph.

HTH,

        Jörg

-------------------------------------------------------------------------
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

Reply via email to