You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We can generate plots on the command line with the plotutils package. You can install this package with:
$ sudo apt-get install plotutils
Returning the gyre dataset, say we want to compare each the A and B files from each dataset. We can join two of the columns with the paste command:
$ paste NENE01751[AB].txt | graph -T png -m 0 -S 3 -X "A values" -Y "B values" -L "NENE01751 A vs B" > NENE01751.png
The -T option sets the output format. We choose png. The default format is "meta", which, as the documentation graph --help helpfully tells us, is probably not what we want.
The -m 0 option sets the format of the lines between points. We want a scatterplot. we set this to zero indicating no lines between points. You can experiment with other values (1,2, ...).
The -S option sets the shape of the points in the plot. We chose 3, which represents data points with X's.
The -X, -Y and -L options set the x-label, y-label, and main plot title, respectively.
We can wrap this in a shell script:
for file in *A.txt
do
name=${file//A.txt}
paste ${name}A.txt ${name}B.txt | graph -T png -m 0 -S 3 -X "A values" -Y "B values" -L "$name A vs B" > $name.png
done
The ${file//A.txt} command is a Bash shortcut to remove the exact string "A.txt" from the end of a variable. In this case, it lets us convert from "NENE01751A.txt" to "NENE01751".
The plotting example in 06 could be improved to be more realistic. For example by using graph from plotutils if it is available in all environments.
The text was updated successfully, but these errors were encountered: