Re: [AMBER] Replacement for xmgrace

From: Jean-Patrick Francoia <jeanpatrick.francoia.gmail.com>
Date: Mon, 1 Feb 2016 14:57:41 +0100

"Plots generally look good"...Yeah maybe with a little formatting as you
suggested. Actually xmgrace has an old look on my platform, a bit like
xleap. That's why I will go for gnuplot.

I had a bit of spare time, so I wrote a quick script:

#!/usr/bin/python
# coding: utf-8

help = """Plot.py

Script to plot (x, y) data from files

Usage:
   plot.py <files>...

Options:
   -h --help Display help
"""


from docopt import docopt
import matplotlib.pyplot as plt

plt.style.use('ggplot')
plt.style.use('seaborn-poster')
plt.tick_params(left='off', bottom='off', top='off', right='off')


arguments = docopt(help)

for arg in arguments['<files>']:
     pts_x = []
     pts_y = []

     with open(arg, 'r') as f:
         for line in f.readlines():
             res = [float(value.strip()) for value in line.split(' ')
                        if value.strip() != '']
             if res:
                 pts_x.append(res[0])
                 pts_y.append(res[1])

     plt.plot(pts_x, pts_y, label=arg)

plt.legend()
plt.show()

Just to try docopt and the new version of matplotlib (which includes
styles). The graph formatting is clearly R-inspired (the devs of
matplotlib finally underestood...).

Usage:
./plot.py summary.EPTOT summary.ETOT

Result:
http://i.imgur.com/FPdBfsz.png

Le 01/02/2016 14:08, David A Case a écrit :
> On Mon, Feb 01, 2016, Lorenzo Gontrani wrote:
>
>> xmgrace is great..and lightweight.
> Just some (off-topic) comments about why I like xmgrace:
>
> 1. Plots generally look good and can be interactively edited if they don't.
> Consider modifying your ~/.grace/templates/Default.agr file to specify
> Helvetica as "font 0" (the default) and change 'xaxis label char size' to 1.25
> (from 1.0); same for yaxis.
>
> 2. A single .agr file has both the data and the formatting in a single file.
> This is good if you come back months or years later and don't remember your
> file naming conventions.
>
> 3. You can also write simple scripts to systematically modify lots of
> files, to replace the data but keep the formatting, etc. Once you grok the
> file syntax (which is pretty straightforward), it's about as easy to write
> scripts to create or manipulate xmgrace files as it is to write gnuplot or
> matplotlib scripts.
>
> 4. Consider aliasing xmgrace to 'xmgrace -hdevice PDF'. This means that
> "print" will create a PDF file (rather than the default PostScript). This is
> likely to be what most people want.
>
> ....dac
>
> (OK: I realize I've probably started a flame war here... Next up: why you
> should write all your code in LISP.)
>
> _______________________________________________
> AMBER mailing list
> AMBER.ambermd.org
> http://lists.ambermd.org/mailman/listinfo/amber


_______________________________________________
AMBER mailing list
AMBER.ambermd.org
http://lists.ambermd.org/mailman/listinfo/amber
Received on Mon Feb 01 2016 - 06:00:04 PST
Custom Search