Using the gracebat utility of xm-grace package I am using the following command in my bash script to plot multiple line graphs and load the legend corresponded to the names of the initial graphs
(cd "${output}/!plots" && exec gracebat RMSD.prot* -legend load -batch "${output}/!temp/combo.bfile" -printfile RMSD.prot.png -hardcopy)
Here is my batch file
HARDCOPY DEVICE \"PNG\"
PAGE SIZE 2560, 2048
xaxis tick major grid on
yaxis tick major grid on
xaxis tick major color \"grey\"
yaxis tick major color \"grey\"
xaxis tick major linewidth 2
yaxis tick major linewidth 2
xaxis tick major linestyle 2
yaxis tick major linestyle 2
xaxis label char size 2.2
yaxis label char size 2.2
xaxis ticklabel char size 2.0
yaxis ticklabel char size 2.0
Which option could I specify to my batch script to modify the apparence of the legend box e.g. to change its position and / or the fond size/ type ?
Could I use some trick (e.g. in bash) to eliminate the repetitive part of the filenames from the legend e.g. "RMSD.prot_6nax" in my case ? For example to rename all of the processed XVG filles on-the-fly by means of removing a part of its filename which should not be appeared on the legend ?
I'm assuming, here, that the names you want are like 6nax_DOPC
, 6nax_DOPE
, etc.
In that case, a crude approach might be something like:
#!/usr/bin/env bash
prefix="RMSD.prot_"
ext=".xvg"
old_wd=$PWD
# create a temporary directory into which we're going to link our output files
tmpdir=$(mktemp -d "${output}/!plots.XXXXXX") || exit
cd "$tmpdir" || exit
for f in ../"${prefix}"*"${ext}"; do
local_f=${f#../}
ln -- "$f" . || continue
mv -- "$local_f" "${local_f#$prefix}" || continue
done
gracebat *"$ext" -legend load -batch "${output}/!temp/combo.bfile" -printfile "$output/!plots/RMSD.prot.png" -hardcopy
gracebat_rc=$?
rm -rf -- "$tmpdir"
exit "$gracebat_rc"
We're leaving the original !plots
directory alone (except for writing output files there), creating a new temporary directory, linking the .xvg
files there, renaming them to remove the unwanted prefix, and then running gracebat against those new names.