Hi Arnd,

On 03.03.06, Arnd Baecker wrote:
> > > To be more precise: I used  a subclass of ``pyx.graph.graphxy`` with
> > >   self.domethods = [ self.dolayout,  self.dobackground, self.dodata,
> > >                      self.doaxes, self.dokey,
> > >                      self.somefurther_routine]
> > >
> > > What is now the preferred way of changing the order or adding
> > > routines? Is overriding ``finish`` the way to go?
> >
> > Exactly. But that should not be a problem, that's exactly what
> > an object-oriented system is good for, isn't it?
> 
> Absolutely - I just wanted to be sure that I don't change
> things back and forth in my code ;-).

Well, than I'm sorry to have to tell you, that the domethods list is
gone in CVS head. The simple reason is, that it's the wrong concept.
We wanted a more flexible dependancy description. An example are
linked axes between graphs in a circular way as in the following
example:

    from pyx import *

    c = canvas.canvas()

    g1 = c.insert(graph.graphxy(width=8,
                                x=graph.axis.linear(min=0, max=1),
                                x2=graph.axis.linkedaxis()))

    g2 = c.insert(graph.graphxy(width=8, ypos=g1.height+0.5,
                                x=graph.axis.linkedaxis(),
                                x2=graph.axis.log(min=1, max=1000)))

    g1.axes["x2"].setlinkedaxis(g2.axes["x2"])
    g2.axes["x"].setlinkedaxis(g1.axes["x"])

    g1.plot(graph.data.function("y(x)=2*exp(-30*x)-exp(-3*x)"))
    g2.plot(graph.data.function("y(x)=cos(20*x)*exp(-2*x)"))

    c.writeEPSfile("link")
    c.writePDFfile("link")

(This runs on CVS head only, not in PyX 0.8.x!)

What happens here, is that to finish the one graph, an axis of the
other graph needs to be layouted and we have an cyclic inter-graph
depenancy. In the old version, this would not be possible, since non
of the layouts of the two graphs can be done before the other, but
for the axes this is of course not the case. So the do-methods can now
also have arguments and there dependancies can be much more
complicated. In the end the finish method becomes much simpler -- it's
just a call to the do-methods needed to paint the parts of the graph
and everything else works like expected (i.e. the other dependancies
are resolved as needed).

So for you ... well, it makes a difference whether we're talking about
PyX 0.8.x and the upcoming PyX versions. I'm sorry. Still, I very much
think that the new code brings a lot of improvements.


André

-- 
by  _ _      _    Dr. André Wobst
   / \ \    / )   [EMAIL PROTECTED], http://www.wobsta.de/
  / _ \ \/\/ /    PyX - High quality PostScript and PDF figures
 (_/ \_)_/\_/     with Python & TeX: visit http://pyx.sourceforge.net/


-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
PyX-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/pyx-user

Reply via email to