From: Ken M. <mc...@ii...> - 2005-12-02 19:44:07
|
On 12/02/05 09:26, And...@gt... wrote: > I'd like to have many more features available to the user than are > currently provided by Mplot, but when I'm coding I'd like to be able to > drop in a complete panel without having to do the coding that I'd need to > do with WxMPL. It sounds you'd like to see a library with a simplified API that supports most kinds of plots while letting users edit things like the axes title, line width, number of histogram bins, etc. Am I correct? > Perhaps with introspection, many of the customizable features could be > automatically extracted and presented to the user, so that menus and dialog > boxes wouldn't have to be completely coded by hand. I would definitely go with introspection and declarative programming. First, come up with a reasonable object picking algorithm (see the `object_picker.py' example). Let matplot manage all of the plot objects' data (axes title, line style, edge color, etc). Use declarative programming to define the editable parameters for each object. Finally, use introspection to map between type of the object and the list of editable parameters. PEP 246 adaption might be useful here, since it would let you break the tight coupling between types and their parameters: def OnPickObject(self, evt): obj = evt.object params = adapt(obj, IObjectParameters, None) if params is not None: frame = ObjectEditorFrame(self, params) frame.Show() # ...imagine that ObjectEditorFrame looks something like right hand # side of the window on page 15 of # http://www.python.org/pycon/papers/chaco.pdf # except that is automagically builds its contents based on the # its IObjectParameters argument. It might be a good idea to bug John about matplotlib transitioning to using the Traits package from Enthough, which would take care of managing the object parameters for you. They developed it for use in their Chaco plotting library, which went MIA shortly after release. > I'd like the plot to appear simple (by default), but with suitable > access (perhaps triggered by mouseover?) to hidden features like a > toolbar, scrollable axes, crosshair cursors (with coordinate readout), > and zoom controls. A toolbar that pops up via mouseover would be pretty impressive, but I can't think of a way to implement it off the top of my head. I'm not sure what you mean by "scrollable axes". Do you mean pannning, the way pylab plots work? Crosshair cursors are easy and coordinate readout are pretty easy and I believe they already work in both MPlot and WxMpl. Likewise zoom controls. > I'm certainly willing and able to contribute to this development. I'm > conflicted as to which code base to begin with, however. I'm not sure what to recommend. Merging MPlot and WxMpl so that MPlot uses WxMpl for rendering and plot-level user interactions like zooming would be one way to start. I think you'd probably be better off going with a more dynamic approach to parameter editing, since it would be a bit more work up front but a lot less work to add plot types. If done right, the object picking and parameters stuff could even be backend independent. Ken |