Becksteinlab / GromacsWrapper

GromacsWrapper wraps system calls to GROMACS tools into thin Python classes (GROMACS 4.6.5 - 2024 supported).

Home Page:https://gromacswrapper.readthedocs.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to plot

frchalaoux opened this issue · comments

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.

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

Either use the %matplotlib magic command #105 (comment) 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")

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.