Becksteinlab / GromacsWrapper

GromacsWrapper wraps system calls to GROMACS tools into thin Python classes (GROMACS 4.6.5 - 2024 supported).
https://gromacswrapper.readthedocs.org
GNU General Public License v3.0
169 stars 53 forks source link

How to plot #105

Closed frchalaoux closed 7 years ago

frchalaoux commented 7 years ago

Hi All,

Have you a snippet that show me how to plot a simple xvg file with GromacsWrapper API ?

My first test with the API documentation stay quiet :

import gromacs.fileformats.xvg as xvg
pot=xvg.XVG("potential.xvg")
pot.plot()
pot.plot(columns=[0,1])

FR.

PicoCentauri commented 7 years ago

Hey @frchalaoux,

are you running in an jupyter notebook or in an ipython session? There you can try to add the magic command %matplotlib inline.

Best

orbeckst commented 7 years ago

Either use the %matplotlib magic command https://github.com/Becksteinlab/GromacsWrapper/issues/105#issuecomment-277552539 or explicitly request the figure: You might have to do a

import matplotlib,pyplot as plt
plt.show()

or save the figure to a file

pot.figure.savefig("potential.png")
frchalaoux commented 7 years ago

Perfect guys, It works with both ;-)

I tested xmgrace these last months but was not very happy with certains capabilities. It helped me to convince with nice figures but now I have to automate all these things with matplotlib/Pandas, etc ... cause MD become my daily bread.

Thanks.