Hi. I've found myself in the position of (a) often having
> to plot data with specific views for either debugging or
> publication purposes. While this is often easy enough to
> write as a python script, I've found myself either
> rewritting the same code over again, or having to create
> a large number of command line parameters to specify
> exactly what type of plot is required. It occured to me
> that it might be nice to have a seperation of data and
> plotting (i.e. MVC) and that XML would work well for
> these purposes (e.g. libglade and renaissance) . For
> example, something like:
My initial response to something like this, which I've seen before in
the context of mpl, is: what is the advantage of using a XML over
python? Except for the plot command, which specifies a read data and
filename, everything is pretty much a literal translation of python.
My suggestion would be to create custom python classes that build your
figures, and use python
class PlotItem:
def __init__(self, fn, fname, var, color, lw):
... do something with it
class SubplotItem:
def __init__(self, title, pos)
....contains one or more plot items
class FigureItem:
def __init__(self, title)
... contains one or more axes items
fig = FigureItem(title="Hodgkin and Huxley cell")
sub = SubplotItem(title="voltage" pos="1,1")
fig.add_subplot(sub)
plot = PlotItem(fn="readData" file="sim.dat", var="voltage")
sub.add_plot(fig)
and so on. Then you have the full power of python to specify your
configuration layer. What does an XML layer buy you? I could see
it's usefulness if you were trying to develop a GUI tool to edit and
configure your figures....
There has been some interest in having a way to save a figure state to
an external file and open it where you left off. An XML
representation might be useful there, in that it would ease the
development of figure editors in a way that a pickled version would
not.
> p.s. I've had the traits-based config library almost done
> for a bit .. I just haven't had time to put the last
> finishing touches on it. I'll email it soon.
Great.