Okay, it's not everyday i say XML is a GoodThing(tm), so you should rather take it now before i take it back.
I'm busy merging my active networks experiments into the next chapter in my Ph.D Thesis, and being a linux-guy, i'm doing this with gnumeric for data collection and analysis, then using inkscape for converting the .svg file into a encapsulated postscript that i will later on integrate in my Latex document.
This is usually done in one command line like
inkscape ixp-collect-latency.svg --print=">eps/ixp-collect-latency.eps"
Well ... usually. This time it didn't worked. For some unknown reason gnumeric decided to include the whole dataset in the figure (rather than what can be seen through the window i defined on the axis), making weird red lines going out of the graph and stroke through the whole page.
So what's the relationship with XML you will ask? very simple. Open the .svg with inkscape (which happens to correctly hide the part of the line i don't want to see) and click in the wild where you know the line goes on. You magically captured the whole path. Pretty weird, no? Now, the good thing is that .svg files are actually XML files describing what should be drawn, where it is, etc. And inkscape features that geek-must-have "XML editor" where you can pick any item you want and have any of its properties modified (well, you could do it with a wonderful text editor too, but figuring out which of the 100+ svg:path is the red line could turn into an unpleasant thing)
So now that i have the svg:path element opened in the dialog box, i can simply pick the actual path stuff and remove the part i don't want (e.g. those lines that have negative X coordinates :P) For those who wonders, there is simply a "d" attribute of the path that consists of M <coordinates> for setting the first point followed by a collection of L <coordinates> to stroke a line to that location. Pretty easy to update, no ?
Now you might argue it doesn't matter whether that's XML and that all i'd have needed was software without bugs, but we all know there cannot be software without bugs, so the fact i can save the day by hacking data around is imho a GoodThing
No comments:
Post a Comment