How to plot .xvg files from GROMACS on Windows
GROMACS produces graphical output in the form of .xvg files. These are designed to be viewed with a classic UNIX/Linux plotting program called Grace. If you happen to be using Linux and you have Grace installed, it is very easy to plot the data with the command
xmgrace my_file.xvgIf you aren’t using Linux, plotting .xvg files is quite a bit more difficult. Gnuplot is the only free plotting program that I have found that can handle .xvg files. Gnuplot is available for Windows (there is a direct download link near the top of the download page), but I will caution you that Gnuplot is not easy to learn. It has a command-line interface, and there are no point-and-click options to do basic operations such as labeling the axes of the plot. If you are using Gnuplot, you can plot the contents of an .xvg file with the command:
plot "my_filename.xvg" u 1:2 w linesIf you are more comfortable with Microsoft Office, you can also plot the contents of .xvg files using Excel. Start Excel, choose File->Open, and select “All Files (*.*) in the lower right corner of the dialog. Select a .xvg file and press Open. The text import wizard should start. Choose Fixed width, Enter 14 where it says, “Start import at row: “ and press Next. A screenshot is shown below. xvg_import_step1
In the next window, remove one of the black vertical lines, and move the other one to Column 15 as shown below. Press Finish.
xvg_import_step2
xvg_data_imported
xvg_Excel_plot
Comments
Comment #1 by nizar
nizar - May 6, 2014
thank you, this article helps me alot. i use gnuplot bytheway.
Comment #2 by Chris
Chris - Dec 1, 2022
Sigma plot. Import as text file from around line 26 with white space delimiter. You will need to change the file header from .xvg to .txt so it comes up on sigma plots file filters. Then you can plot pretty nice figure sigma plot.