Hello list, I was trying to create some interactive SVGs with matplotlib and I faced the following issues. Some maybe bugs, some other just missing functionality. I'm just summarising my experience so that you are aware of the issues.
First of all I used git-head from a couple of monts ago with python-3.2, and I'm quite happy that it worked. :-) My target was to make the dots in a plot(x,y,"-o") graph clickable. Here are the issues I faced: * I didn't find a way to set an "id" attribute for each marker. Googling revealed that I should probably call set_gid() but I had no success. So I stored the whole XML file into memory and searched for the <use> tags inside <g id="line2d_1">. The ideal would have been for each <use> to have a specific id, or at least the <g> containing the <use>s. * pylab.savefig(f, format="svg") never worked whenever f was sys.stdout or io.StringIO. It seems that it err'ed on every file that didn't support open(). My workaround was to write to a tempfile and read back. Maybe support for this can be added together with support for already opened files, so that the with-statement works? I /think/ errors were like the following: File "~/dist/src/matplotlib-git/matplotlib/build/lib.linux-i686-3.2/matplotlib/backends/backend_svg.py", line 1101, in print_svg return self._print_svg(filename, svgwriter, fh_to_close, **kwargs) UnboundLocalError: local variable 'svgwriter' referenced before assignment * I couldn't use pylab.ticklabel_format() with SVG engine (I was trying to apply an offset to the xticks labels), error message was the following, it's quite probable I don't understand how this works: File "~/dist/src/matplotlib-git/matplotlib/build/lib.linux-i686-3.2/matplotlib/axes.py", line 2191, in ticklabel_format "This method only works with the ScalarFormatter.") * I wanted some onmouseover() bubble annotation over specific markers but I gave up on this. Ideally I'd want to refer to the markers with a specific ID, give them different color style, and be able to add specific <title> or <text> elements where I want and manipulate them via javascript. Since I understand this is too much to ask from matplotlib I'd very much like the possibility to get the XML tree in some form *before* writing anything to disk. Does the SVG backend use the python xml.etree.ElementTree module? If only I could get the whole ElementTree, I would manipulate it as I'd like before writing to disk. What would you suggest to achieve the result I need? I also had some difficulties with the website. For example when investigating various plotting utilities and checking their SVG output, I couldn't find anywhere the example from [1] rendered as SVG. The gallery is huge, but it is barely searchable (no text anywhere) so I still might have missed it. Secondly I'd appreciate a table of contents on top of the API pages, e.g. at http://matplotlib.sourceforge.net/api/pyplot_api.html [1] http://matplotlib.sourceforge.net/examples/user_interfaces/svg_histogram.html Finally, using more and more matplotlib I realised that some things are more complex than necessary. I'm talking specifically for when subplots or twin axes are involved. Then it is hard to keep a common legend (you have to keep track of the labels yourself). It is also hard to cycle the colors among the different axes (you have to keep track of the colors yourself). To have a common ylabel among the vertical subplots I just set the ylabel for the middle subplot, which seems like a hack. And also suptitle() seems weaker than title() (not bold, smaller font). Finally labels of yticks many times overlap each other at the border of adjascent subplots, so I have to manually compensate using set_major_locate() for sparser yticks. Even though some things needed time-consuming hacks, matplotlib worked fine. Thanks for your work on this fantastic library! And if you are curious you can see my automatic generated graphs (temporarily) at: http://teras-ics.mooo.com:8003 thanks, Dimitris P.S. I sent this email (slightly changed) again a couple of months ago, but it got stuck in moderation. Thus I send it again now after subscribing, sorry if you get it twice. ------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ _______________________________________________ Matplotlib-devel mailing list Matplotlib-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-devel