.. _pylab_examples-loadrec:

pylab_examples example code: loadrec.py
=======================================



.. plot:: /home/mandrake/rpm/BUILD/matplotlib-0.99.3/doc/mpl_examples/pylab_examples/loadrec.py

::

    from matplotlib import mlab
    from pylab import figure, show
    
    a = mlab.csv2rec('../data/msft.csv')
    a.sort()
    print a.dtype
    
    fig = figure()
    ax = fig.add_subplot(111)
    ax.plot(a.date, a.adj_close, '-')
    fig.autofmt_xdate()
    
    # if you have xlwt installed, you can output excel
    import mpl_toolkits.exceltools as exceltools
    exceltools.rec2excel(a, 'test.xls')
    show()
    

Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`)