direct plot fromfile?

Le Mercredi 05 Avril 2006 11:36, manouchk a ?crit?: I

    > made a mistake with my mail. Just correcting it, sorry
    > for inconvenience.

    > Hi,

    > Data file I use usually have a first line or more with
    > comments and sometimes column with text. I used to use
    > gnuplot that now automatically skips rows that does not
    > contain numbers (before one should use every n to skip n
    > forst line) and handle well files that have column
    > without number. using column 3 and 4 from a file to
    > plot is done using using 3:3. I wondering if there is
    > an hidden possibilty to plot more or less directly from
    > file as in gnuplot.

    > imagine the file : col1 col2 col3 col4 col5 col6 T3-4B
    > 450 100 4.31 1.44 0 T3-4B 450 200 5.56 2.06 0 T3-4B 450
    > 500 6.03 2.09 0 T3-4A 450 5000 9.71 2.16 0

    > that would be a function that plots column number 3 and
    > 4 skipping first line and ignoring first column (that
    > would put zeros in the array for example) A fonction
    > that would do that could look like that one:
    > plotfromfile(file="data",using=(3,4),skippingline=1,ignorecolumn=[1])

The latest matplotlib release includes some enhancements to the load
function to allow you to skip rows and extract certain columns. It
also allows you to pass in converter functions to convert certain
columns to floating point numbers, eg for dates. See
examples/load_demo.py for a full example. Here is an example
skipping the header and extracting the 3rd and 4th column:

  from pylab import figure, load, show
  x, y = load('test.dat', skiprows=1, usecols=(2,3), unpack=True)
  fig = figure()
  ax = fig.add_subplot(111)
  ax.plot(x,y)
  show()

JDH