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.
select the line style for the lines connecting the points in the set. select the line width for the lines. the color to use when drawing lines. select the type of fill, none, as polygon, to y=0.0, x=0.0, x=graph Xmin, x=graph Xmax, y=graph Ymin, y=graph Ymax.
If you click on the Plot icon at the top of the xmgrace window, and then select Axis Properties, you will get a menu which allows you to control the range of the data shown (the values in the “Start” and “Stop” boxes). The very top box allows you to choose whether to work with the X- or Y- axis.
The correct syntax for this kind of problem is
xmgrace -block file -bxy 1:3
This will
Another flexible way of accomplishing the same thing is to use awk
or cut
:
awk '{print $1,$3}' data | xmgrace -
cut -f1,3 data | xmgrace -
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With