plot different columns

Hi,

I have a small script which reads a csv file with several
columns and puts it into an scipay array, which
I can plot using matplotlib. It works fine, but just with
explicitly setting the number of columns:

  res=loglog(array_mapped[:,0],array_mapped[:,1], 'b',
                array_mapped[:,0],array_mapped[:,2], 'g',
                array_mapped[:,0],array_mapped[:,3], 'r',
                array_mapped[:,0],array_mapped[:,4], 'y',
                array_mapped[:,0],array_mapped[:,5], 'k',
                array_mapped[:,0],array_mapped[:,6], '-bo',
linewidth = 2)

Is there a way to define the number of columns, which I want
to plot? Or even better, can I apply an sys.argv to
define the plotted columns, e.g.
"python csvplot.py all": which plots all columns with its
value for the y-coordinate and the line-number as x-coordinate
"python csvplot.py all1": which does the same as above, but
using column 1 as abscissae
"python csvplot.py 1 2 5": which plots columns 2 and 5
against column 1...

Would be nice, if anybody has an idea, how to achieve this!?
Regards!
Fabian

Does nobody have an idea; especially for the 'dynamic'
number of plotted arrays!?
Regards!
Fabian

···

Fabian Braennstroem schrieb am 09/09/2007 09:01 PM:

Hi,

I have a small script which reads a csv file with several
columns and puts it into an scipay array, which
I can plot using matplotlib. It works fine, but just with
explicitly setting the number of columns:

  res=loglog(array_mapped[:,0],array_mapped[:,1], 'b',
                array_mapped[:,0],array_mapped[:,2], 'g',
                array_mapped[:,0],array_mapped[:,3], 'r',
                array_mapped[:,0],array_mapped[:,4], 'y',
                array_mapped[:,0],array_mapped[:,5], 'k',
                array_mapped[:,0],array_mapped[:,6], '-bo',
linewidth = 2)

Is there a way to define the number of columns, which I want
to plot? Or even better, can I apply an sys.argv to
define the plotted columns, e.g.
"python csvplot.py all": which plots all columns with its
value for the y-coordinate and the line-number as x-coordinate
"python csvplot.py all1": which does the same as above, but
using column 1 as abscissae
"python csvplot.py 1 2 5": which plots columns 2 and 5
against column 1...

Would be nice, if anybody has an idea, how to achieve this!?
Regards!
Fabian

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

The question is unclear.
The problem seems easy enough,
if you get your hands on the arguments to your script.
http://homepage.mac.com/andykopra/pdm/tutorials/simplifying_script_arguments.html

hth,
Alan Isaac

···

On Thu, 13 Sep 2007, Fabian Braennstroem apparently wrote:

Does nobody have an idea; especially for the 'dynamic'
number of plotted arrays!?

Hi,

Does nobody have an idea; especially for the 'dynamic'
number of plotted arrays!?

The question is unclear.
The problem seems easy enough,
if you get your hands on the arguments to your script.
http://homepage.mac.com/andykopra/pdm/tutorials/simplifying_script_arguments.html

Thanks for your help; the question is a bit unclear indeed...
Handling the sys.argv was not the problem; actually my main
problem is to tell the
'plot' or 'loglog' command, that I have a different number
of arrays.
Lets say I have to columns, the I could use in a script:

    res=plot(array_mapped[:,0],array_mapped[:,1], 'b',
                array_mapped[:,0],array_mapped[:,2], 'g')

The next time a have 5 columns in a file and want to plot
all 5 columns without adjusting the 'plot' command
in the script, but just by defining an argument when
starting the script. I have to adjust somehow dynamically
the plot command to adjust the number of graphs in one
figure; but that is the problem...
Fabian

···

Alan G Isaac schrieb am 09/13/2007 06:15 PM: > On Thu, 13 Sep 2007, Fabian Braennstroem apparently wrote: