On 8/27/07, Matt Fago <[EMAIL PROTECTED]> wrote:
>
>  I'm elated to have found matplotlib after struggling with octave and
> gnuplot.
>
> There is one thing that I think matplotlib could improve on (or that I
> cannot find)
> -- quick plotting a la gnuplot:
>
>    plot "file.txt" using 1:2 with lp
>
> For matplotlib, perhaps something like the following:
>
>    fplot("filename", cols=(1,5), delimiter=',', numheader=2)
>


I matplotlib svn (as of June) there is a plotfile function.  From the
docstring:

Help on function plotfile in module matplotlib.pylab:

plotfile(fname, cols=(0,), plotfuncs=None, comments='#', skiprows=0,
checkrows=5, delimiter=',', **kwargs)
    plot the data in fname

    cols is a sequence of column identifiers to plot.  An identifier
    is either an int or a string.  if it is an int, it indicates the
    column number.  If it is a string, it indicates the column header.
    mpl will make column headers lower case, replace spaces with
    strings, and remove all illegal characters; so 'Adj Close*' will
    have name 'adj_close'

    if len(cols)==1, only that column will be plotted on the y axis.
    if len(cols)>1, the first element will be an identifier for data
    for the x axis and the remaining elements will be the column
    indexes for multiple subplots

    plotfuncs, if not None, is a dictionary mapping identifier to an
    Axes plotting function as a string.  Default is 'plot', other
    choices are 'semilogy', 'fill', 'bar', etc...  You must use the
    same type of identifier in the cols vector as you use in the
    plotfuncs dictionary, eg integer column numbers in both or column
    names in both.

    comments, skiprows, checkrows, and delimiter are all passed on to
    matplotlib.mlab.csv2rec to load the data into a record array

    kwargs are passed on to plotting functions

    Example usage:

      # plot the 2nd and 4th column against the 1st in two subplots
      plotfile(fname, (0,1,3))

      # plot using column names; specify an alternate plot type for volume
      plotfile(fname, ('date', 'volume', 'adj_close'), plotfuncs={'volume':
'semilogy'})
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to