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 objectoriented 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 intergraph
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 domethods 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 domethods 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
/ \ \ / ) wobsta@..., http://www.wobsta.de/
/ _ \ \/\/ / PyX  High quality PostScript and PDF figures
(_/ \_)_/\_/ with Python & TeX: visit http://pyx.sourceforge.net/
