Prepare Xmgrace input.

For people using scientific data-sets, often need to plot using Xmgrace (or GNUplot etc). However one might print data in multiple column format, and would like to select one of these columns only for plotting as y-axis with a user defined x-axis.

Here I am providing a perl code such as to take an file with input as shown below, and select only the 1st-column and plot it as y-axis. The code also demarks an x-axis starting with 2, with a step increment of 0.5.


0.582940966    0.52259173    0.98484968
0.456635    0.39353965    0.98544163
0.36926669    0.31931631    0.98585594
0.308628579    0.26983253    0.98615402
0.265035464    0.23422171    0.98638789
0.232430642    0.20719395    0.98656461
0.207167749    0.18594167    0.98671602
0.187011844    0.16871937    0.98683502

Perl Code – Detailed Code

Output – Output of the perl code, an input for Xmgrace.

* This is aimed at being a template for users to prepare Xmgrace input files for data generated by themselves.
You can tweak the code to do arithmetic operations before the y-axis is printed out.