In the process of creating a Cocoa app for scientific data acquisition, I've built an NSImageView subclass that displays an MPL figure in the Cocoa NSView hierarchy. It's based on the CocoaAgg backend code in MPL. There are also some subclasses that allow the use of Cocoa Bindings to supply the data, axis labels, and units for the figure. Finally, I've created an IB palette for adding one of the PlotView subclasses to a Cocoa app and setting its bindings in Interface Builder.
For plotting data passed via NSData instances is converted to a numpy array via numpy.frombuffer using the PlotView's .dtype parameter as the array dtype (see the source for DataPlotView in PlotView.py). I think the ability to have such a powerful plotting library available from Cocoa with so few lines of code illustrates the huge power of the combination of Cocoa, PyObjC, and the many good Python libraries such as MPL. CocoaMPLPlotView requires PyObjc, numpy, and matplotlib. You can download a copy of the CocoaMPLPlotView and CocoaMPLPlotViewPalette source from http://fairhall-lab.physiol.washington.edu/~bwark/mpl/. I don't have time to provide support for these, but would love to hear if anyone finds them useful. Obviously if you have comments, bugs, or patches, I'd love to hear those as well. Happy coding. Thanks, Barry ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users