2

I am using xmgrace to plot several graphs on a shared axed, from a two-column data file like so:

@    title "RMSD"
@    xaxis  label "Time (ns)"
@    yaxis  label "RMSD (nm)"
@TYPE xy
@ subtitle "C-alpha after lsq fit to C-alpha"
   1.7125001    0.0005074
   1.7225001    0.0635904
   1.7325001    0.0747008
   1.7425001    0.0707590
   1.7525001    0.0821623
   1.7625000    0.0842335
   1.7725000    0.0929994
   1.7825000    0.0938834
   1.7925001    0.1014052
   1.8025001    0.1107717
   1.8125001    0.1106072
   1.8225001    0.1032858
   1.8325001    0.0967231
   1.8425001    0.1072746

So, I call the command to show me all graphs on the GUI

xmgrace 1.xvg rmsd_amber_2.xvg rmsd_3.xvg

Is it possible to automatically use the filenames as the labels for the legend, using an option found within the GUI of xmgrace? So far xmgrace automatically uses different line colors for each data series, but does not show the filename as the data label.

If this is not possible, please suggest me another GUI software for Linux which is able to open xvg files from the terminal for its visualization "on the fly".

Thanks !

feedMe
  • 3,431
  • 2
  • 36
  • 61

1 Answers1

1

Xmgrace does not do what you want

The xmgrace help (shown by calling xmgrace --help at the terminal) shows that there is no command line flag to specify data set legend titles. If that were the case you could probably come up with some bash commands to parse the title from your data files.

But there is another way

As an alternative, you can load a parameters file containing the correct titles. If you save any parameters file from within the xmgrace GUI and load it in a text editor, you will see that almost every aspect of Plot, Graph and Set appearance properties can be controlled.

However, it is not all needed; we can delete almost all of that information and just keep the lines related to our data set legend titles (everything else will just take the default values).

Solution

A minimal parameter file "template.par" might contain just the following four lines:

with g0
  s0 legend "title0"
  s1 legend "title1"
  s2 legend "title2"

where in your case "title1" would be "RMSD".

You can then use xmgrace -param template.par 1.xvg rmsd_amber_2.xvg rmsd_3.xvg to create the plot.

Automating it

So far so good, but you want to create template.par automatically by parsing your chosen bunch of .xvg files. You could probably achieve this in any number of different ways using a bash script or even a bash one-liner.

feedMe
  • 3,431
  • 2
  • 36
  • 61