How can I build specific columns using xmgrace in terminal?

I want to write a bash script to automate the construction of data using a graphing tool called xmgrace, but I want to be able to choose which columns will be built.

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

I tried xmgrace -bxy [1:3] data , but this did not work, it said No block data read and processed the second column as y values.

+8
terminal plot xmgrace
source share
2 answers

The correct syntax for this problem is

 xmgrace -block file -bxy 1:3 

This will

  • Read the file as a block file
  • Select the third column against the 1st column.
+11
source share

Another flexible way to achieve the same goal is to use awk or cut :

 awk '{print $1,$3}' data | xmgrace - cut -f1,3 data | xmgrace - 
+2
source share

Source: https://habr.com/ru/post/651082/


All Articles