On 27 Mar 2014, at 09:28, Edward d'Auvergne <edward@xxxxxxxxxxxxx> wrote:
Hi, The following is planning document for adding support for matplotlib graphing to relax. The plan will be broken into a few simple steps: 1) Module detection. Firstly the dep_check module would need to be modified to detect the presence of the matplotlib Python package. In addition, the package_info() method in the 'info' module should be changed to print out if matplotlib is present and which version is present (matplotlib.__version__). Then matplotlib will be shown when running relax with the --info command line option. 2) Icons For the GUI and the user manual, icons are needed. These can be taken from the matlplotlib sources and added to the graphics/relax_icons/ directories. The 16x16, 24x24, 32x32, and 48x48 icons could be taken from the ./doc/_static/favicon.ico file, specifically layers #4, #5, and #6. The 128x128 icon used in the manual could be regenerated using the matplotlib graphic script ./examples/api/logo2.py, but with the text removed. 3) Uf frontend. For this, the user_functions.grace module can be copied and modified to change all instances of 'grace' with 'matplotlib'. So the user functions would be matplotlib.view and matplotlib.write. New user functions could be added later on if additional functionality from matplotlib is desired. 4) Uf backend. The pipe_control.grace module can be copied to pipe_control.matplotlib and changed as needed. The key functions are view() and write() as these are used by the user function frontends. All other functions can be added as needed to simplify the matplotlib graph generation (and the old ones form grace deleted). 5) Saving format. Do we output in SVG or PNG? I don't know matplotlib, but is there a way of saving a matplotlib native file format so it can be modified later? The options should be available as arguments to the matplotlib.write user function.
Hi Ed you can save in pdf and eps. I personally would save in SVG or PDF as the default because these are easily manipulated by coreldraw and illustrator and are resolution independent. As to saving the files you could most probably pickle the data structures created by plot subplot etc to disk. However, there would be no guarantee that such save plots would be portable between versions… I would also say that my experience with svg has been patchy. I find that you need to be quite careful to produce results that behave well on a variety of platforms and with a variety of programs. In general I find pdf more fully platform independent and easier to display (almost everyone has evince or acroread or both). Also it is is an easy format to turn into a bitmap with ImageMagik etc if needed. I have some experience with matplotlib and pylab, but I am afraid I will most probably only be able to provide advice or sample code as opposed coding hours, things seem to be crazy busy! regards gary
Completion of these steps is sufficient for full matplotlib support within relax. Then adding the plotting as default for the auto-analyses would be trivial. Regards, Edward _______________________________________________ relax (http://www.nmr-relax.com) This is the relax-devel mailing list relax-devel@xxxxxxx To unsubscribe from this list, get a password reminder, or change your subscription options, visit the list information page at https://mail.gna.org/listinfo/relax-devel