unpacking multiple files

Friends,

  1. I want to make a plot of multiple lines. I want to make something like

./multiplot.py 1.dat 2.dat 3.dat … n.dat

All files contain two columns and are of same length. plotfile() and load() do not take list of file but one file name only. In such cases, I want to unpack the x,y values in 1.dat,2.dat… n.dat and plot it at a stretch. What is the best way to do it. Any suggestion would be highly helpful.

  1. How can i fix the default values, like first line should be black, second line in red …, third in blue.

Thanks
bala

Hi Bala,

Friends,

1) I want to make a plot of multiple lines. I want to make something like

./multiplot.py 1.dat 2.dat 3.dat ...... n.dat

All files contain two columns and are of same length. plotfile() and load()
do not take list of file but one file name only. In such cases, I want to
unpack the x,y values in 1.dat,2.dat.... n.dat and plot it at a stretch.
What is the best way to do it. Any suggestion would be highly helpful.

you may just run through the list sys.argv like

for filename in sys.argv:
    plotlfile(filename, ...)

2) How can i fix the default values, like first line should be black,
second line in red ...., third in blue.

define your own favourite color-list like

my_colors = ['black', 'red', 'blue']

and afterwards circle through this like:

for index, filename in enumerate(sys.argv):
    plotlfile(filename, ..., color=my_colors[index])

regards Matthias

···

On Tuesday 31 March 2009 17:00:59 Bala subramanian wrote:

Thanks
bala