Search code examples
plotterminalxmgrace

How do I plot certain columns using xmgrace in the terminal?


I want to write a bash script to automate the plotting of data, using a plotting tool called xmgrace, but I want to be able to select which columns are plotted.

Say in my data file I have 3 columns, with the x and y data in the 1st and 3rd columns. How do I plot x against y when the data is formatted this way?

I tried xmgrace -bxy [1:3] data but that didn't work, it said No block data read and treated the second column as the y values.


Solution

  • The correct syntax for this kind of problem is

    xmgrace -block file -bxy 1:3 
    

    This will

    1. Read the file as a block file
    2. Plot the 3rd column against the 1st column.