SourceForge logo
SourceForge logo
Menu

Re: [matplotlib-devel] XML

From: John H. <jdh...@ac...> - 2005年02月25日 15:29:03
>>>>> "Abraham" == Abraham Schneider <ab...@cn...> writes:
 Abraham> Hi. I've found myself in the position of (a) often having
 Abraham> to plot data with specific views for either debugging or
 Abraham> publication purposes. While this is often easy enough to
 Abraham> write as a python script, I've found myself either
 Abraham> rewritting the same code over again, or having to create
 Abraham> a large number of command line parameters to specify
 Abraham> exactly what type of plot is required. It occured to me
 Abraham> that it might be nice to have a seperation of data and
 Abraham> plotting (i.e. MVC) and that XML would work well for
 Abraham> these purposes (e.g. libglade and renaissance) . For
 Abraham> 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.
 Abraham> p.s. I've had the traits-based config library almost done
 Abraham> for a bit .. I just haven't had time to put the last
 Abraham> finishing touches on it. I'll email it soon.
Great.

View entire thread

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.
Thanks for helping keep SourceForge clean.
X





Briefly describe the problem (required):
Upload screenshot of ad (required):
Select a file, or drag & drop file here.
Screenshot instructions:

Click URL instructions:
Right-click on the ad, choose "Copy Link", then paste here →
(This may not be possible with some types of ads)

More information about our ad policies

Ad destination/click URL:

AltStyle によって変換されたページ (->オリジナル) /