def plotfile(fname, cols=(<NUM_LIT:0>,), plotfuncs=None,<EOL>comments='<STR_LIT:#>', skiprows=<NUM_LIT:0>, checkrows=<NUM_LIT:5>, delimiter='<STR_LIT:U+002C>',<EOL>**kwargs):
fig = figure()<EOL>if len(cols)<<NUM_LIT:1>:<EOL><INDENT>raise ValueError('<STR_LIT>')<EOL><DEDENT>if plotfuncs is None:<EOL><INDENT>plotfuncs = dict()<EOL><DEDENT>r = mlab.csv2rec(fname, comments=comments,<EOL>skiprows=skiprows, checkrows=checkrows, delimiter=delimiter)<EOL>def getname_val(identifier):<EOL><INDENT>'<STR_LIT>'<EOL>if is_string_like(identifier):<EOL><INDENT>return identifier, r[identifier]<EOL><DEDENT>elif is_numlike(identifier):<EOL><INDENT>name = r.dtype.names[int(identifier)]<EOL>return name, r[name]<EOL><DEDENT>else:<EOL><INDENT>raise TypeError('<STR_LIT>')<EOL><DEDENT><DEDENT>xname, x = getname_val(cols[<NUM_LIT:0>])<EOL>if len(cols)==<NUM_LIT:1>:<EOL><INDENT>ax1 = fig.add_subplot(<NUM_LIT:1>,<NUM_LIT:1>,<NUM_LIT:1>)<EOL>funcname = plotfuncs.get(cols[<NUM_LIT:0>], '<STR_LIT>')<EOL>func = getattr(ax1, funcname)<EOL>func(x, **kwargs)<EOL>ax1.set_xlabel(xname)<EOL><DEDENT>else:<EOL><INDENT>N = len(cols)<EOL>for i in range(<NUM_LIT:1>,N):<EOL><INDENT>if i==<NUM_LIT:1>:<EOL><INDENT>ax = ax1 = fig.add_subplot(N-<NUM_LIT:1>,<NUM_LIT:1>,i)<EOL>ax.grid(True)<EOL><DEDENT>else:<EOL><INDENT>ax = fig.add_subplot(N-<NUM_LIT:1>,<NUM_LIT:1>,i, sharex=ax1)<EOL>ax.grid(True)<EOL><DEDENT>yname, y = getname_val(cols[i])<EOL>funcname = plotfuncs.get(cols[i], '<STR_LIT>')<EOL>func = getattr(ax, funcname)<EOL>func(x, y, **kwargs)<EOL>ax.set_ylabel(yname)<EOL>if ax.is_last_row():<EOL><INDENT>ax.set_xlabel(xname)<EOL><DEDENT>else:<EOL><INDENT>ax.set_xlabel('<STR_LIT>')<EOL><DEDENT><DEDENT><DEDENT>if xname=='<STR_LIT:date>':<EOL><INDENT>fig.autofmt_xdate()<EOL><DEDENT>draw_if_interactive()<EOL>
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.
matplotlib will make column headers lower case, replace spaces with
underscores, 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 :class:`~matplotlib.axes.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
:func:`matplotlib.pylab.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'})