Hi,
I am trying to use recursively a matplotlib script to create 650 plots.
For this, I have defined
cluster = loadtxt(sys.argv[1])
MBH = loadtxt ('./TrajectoryMBH.asc')
X_cl = cluster[:, 2] # Column 3
Y_cl = cluster[:, 3] # Column 4
Z_cl = cluster[:, 4] # Column 5
X_mbh = MBH[:, 2] # Column 3
Y_mbh = MBH[:, 3] # Column 4
Z_mbh = MBH[:, 4] # Column 5
because "cluster" is the file that changes. TrajectoryMBH.asc is
always the same file for all 650 plots
This way, I can run
./Hit_Cluster_MBH.py MYFILE_001.dat
and the script takes MYFILE_001.dat as "cluster".
Now, I would like matplotlib to produce the eps file automatically,
without any popup window.
For this, I usually define
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
and the, at the very bottom, instead of
show()
I have
plt.savefig('MyEPS.eps')
What I would like though is that matplotlib produces automatically
MYFILE_001.eps
MYFILE_002.eps
etc
when running the python script within a shell script such as
for file in $(ls *dat) ; do ; ./Hit_Cluster_MBH.py $file ; done
but I do not know how to do this in the
plt.savefig('MyEPS.eps')
part...
Obviously
plt.savefig('$file.eps')
does not work.
Any hint will be appreciated.
Thanks,
Pau